def __set_auth_filter(session, rsusr002_filter): SAPGuiElements.select_element(session, PRIVILEGE_TAB) for i, auth in enumerate(rsusr002_filter.auth_objects): if i >= MAX_AUTH_OBJECTS: break SAPGuiElements.try_to_set_text( session, AUTH_OBJECT_TEMPLATE.format(type="{type}", num=i + 1), auth.name) SAPGuiElements.press_keyboard_keys(session, "Enter") for k in range(0, 10): try: text = SAPGuiElements.get_text( session, FIELD_NAME_TEMPLATE.format(num=i + 1, num1=k)) except AttributeError: break else: values = auth.get_values_for_field(text) if not values or len(values) == 0: continue for j, value in enumerate(values): if j >= MAX_AUTH_VALUES: break SAPGuiElements.try_to_set_text( session, AUTH_VALUES_TEMPLATE.format(type="{type}", num=i + 1, num1=k, num2=j + 1), value)
def __set_roles_filter(session, roles_filter): SAPGuiElements.press_button(session, ROLES_FILTER_BUTTON) for i, item in enumerate(roles_filter): SAPGuiElements.try_to_set_text( session, EQUAL_FILTER_TEMPLATE.format(type="{type}", num=i), item) SAPGuiElements.press_button(session, OK_BUTTON)
def __set_filter_by_user_type(session, user_types): SAPGuiElements.press_button(session, USER_TYPE_FILTER_BUTTON) for i, user_type in enumerate(user_types): SAPGuiElements.try_to_set_text( session, INCLUDE_VALUES_TEMPLATE.format(type="{type}", row=i), user_type) SAPGuiElements.press_button(session, OK_BUTTON)
def set_filter(self, session): SAPGuiElements.press_keyboard_keys(session, "Shift+F4") if hasattr(self, "exclude_single_values"): if len(self.exclude_single_values): SAPGuiElements.select_element(session, EXCLUDE_VALUES) for i, item in enumerate(self.exclude_single_values): if item == "": SAPGuiElements.press_button(session, EXCLUDE_VALUES_BUTTON.format(i)) SAPGuiElements.press_button(session, OK_BUTTON_FILTER) else: SAPGuiElements.try_to_set_text(session, EXCLUDE_VALUES_TEMPLATE.format(type="{type}", row=i), item) if hasattr(self, "equal_single_values"): if len(self.equal_single_values): SAPGuiElements.select_element(session, INCLUDE_VALUES) for i, item in enumerate(self.equal_single_values): if item == "": SAPGuiElements.press_button(session, INCLUDE_VALUES_BUTTON.format(i)) SAPGuiElements.press_button(session, OK_BUTTON_FILTER) else: SAPGuiElements.try_to_set_text(session, INCLUDE_VALUES_TEMPLATE.format(type="{type}", row=i), item) SAPGuiElements.press_keyboard_keys(session, "F8")