def test_success(self): lib.create_group(self.acls, "group1") self.assert_cib_equal(self.create_cib().append_to_first_tag_name( "configuration", """ <acls> <acl_role id="group2"/> <acl_group id="group1"/> </acls> """))
def test_success(self): lib.create_group(self.cib.tree, "group1") self.assert_cib_equal(self.create_cib().append_to_first_tag_name( "configuration", """ <acls> <acl_role id="group2"/> <acl_group id="group1"/> </acls> """ ))
def test_existing_id(self): assert_raise_library_error( lambda: lib.create_group(self.cib.tree, "group2"), ( severities.ERROR, report_codes.ID_ALREADY_EXISTS, {"id": "group2"} ) )
def create_group(lib_env, group_id, role_list): """ Create new group with id group_id and assign roles role_list to it. Raises LibraryError on any failure. lib_env -- LibraryEnvironment group_id -- id of new group role_list -- list of roles to assign to new group """ with cib_acl_section(lib_env) as acl_section: acl.assign_all_roles(acl_section, role_list, acl.create_group(acl_section, group_id))
def create_group(lib_env, group_id, role_list): """ Create new group with id group_id and assign roles role_list to it. Raises LibraryError on any failure. lib_env -- LibraryEnvironment group_id -- id of new group role_list -- list of roles to assign to new group """ cib = lib_env.get_cib(REQUIRED_CIB_VERSION) _assign_roles_to_element(cib, acl.create_group(cib, group_id), role_list) lib_env.push_cib(cib)
def create_group(lib_env, group_id, role_list): """ Create new group with id group_id and assign roles role_list to it. Raises LibraryError on any failure. lib_env -- LibraryEnvironment group_id -- id of new group role_list -- list of roles to assign to new group """ with cib_acl_section(lib_env) as acl_section: acl.assign_all_roles( acl_section, role_list, acl.create_group(acl_section, group_id) )