示例#1
0
 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>
         """))
示例#2
0
 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>
         """
     ))
示例#3
0
 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"}
         )
     )
示例#4
0
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))
示例#5
0
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)
示例#6
0
文件: acl.py 项目: jmartign/pcs
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)
示例#7
0
文件: acl.py 项目: HideoYamauchi/pcs
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)
        )