Ejemplo n.º 1
0
 def _create_domains(self):
     self.d1 = utils.create_domain(self.admin_client, 'd1')
     utils.grant_domain_role(self.admin_client, self.admin_role.id,
                             self.admin.id, self.d1.id)
     self.d2 = utils.create_domain(self.admin_client, 'd2')
     utils.grant_domain_role(self.admin_client, self.admin_role.id,
                             self.admin.id, self.d2.id)
 def test_grant_user_role_in_domain(self):
     try:
         utils.grant_domain_role(self.client, self.member_role.id,
                                 self.p2member.id, self.d1.id)
     except:
         self.fail('Unexpected exception raised: '
                   'utils.grant_domain_role(self.client,'
                   'self.member_role.id,'
                   'self.p2member.id, self.d1.id)')
 def test_grant_user_role_in_domain(self):
     try:
         utils.grant_domain_role(self.client, self.member_role.id,
                                 self.p2member.id, self.d1.id)
     except:
         self.fail('Unexpected exception raised: '
                   'utils.grant_domain_role(self.client,'
                   'self.member_role.id,'
                   'self.p2member.id, self.d1.id)')
 def _create_domains(self):
     self.d1 = utils.create_domain(self.admin_client, 'd1')
     utils.grant_domain_role(self.admin_client, self.admin_role.id,
                             self.admin.id, self.d1.id)
     utils.grant_domain_role(self.admin_client, self.cloud_admin_role.id,
                             self.admin.id, self.d1.id)
     self.d2 = utils.create_domain(self.admin_client, 'd2')
     utils.grant_domain_role(self.admin_client, self.admin_role.id,
                             self.admin.id, self.d2.id)
     utils.grant_domain_role(self.admin_client, self.cloud_admin_role.id,
                             self.admin.id, self.d2.id)
 def test_grant_user_role_in_domain(self):
     with self.assertRaises(Exception):
         utils.grant_domain_role(self.client, self.member_role.id,
                                 self.p2member.id, self.d1.id)
Ejemplo n.º 6
0
and domain_id:cloud_admin_domain_id",
"""

# Regular admin login
admin_client = utils.create_client('admin', 'admin', 'admin', 'Default',
                                   'Default', 'http://*****:*****@example.com', admin_project.id,
                                admin_domain.id)

# Create cloud_admin role (admin in this case)
admin_role = utils.create_role(admin_client, 'admin')

# Grant roles at cloud_admin_domain and cloud_admin_project
utils.grant_project_role(admin_client, admin_role.id, cloud_admin.id,
                         admin_project.id)
utils.grant_domain_role(admin_client, admin_role.id, cloud_admin.id,
                        admin_domain.id)

# Print cloud_admin_domain id to be used at domain_id rule
print admin_domain.id
                                   'Default',
                                   'Default',
                                   'http://*****:*****@example.com',
                                admin_project.id,
                                admin_domain.id)

# Create cloud_admin role (admin in this case)
admin_role = utils.create_role(admin_client, 'admin')

# Grant roles at cloud_admin_domain and cloud_admin_project
utils.grant_project_role(admin_client, admin_role.id,
                         cloud_admin.id, admin_project.id)
utils.grant_domain_role(admin_client, admin_role.id,
                        cloud_admin.id, admin_domain.id)

# Print cloud_admin_domain id to be used at domain_id rule
print admin_domain.id
Ejemplo n.º 8
0
 def test_grant_user_role_in_domain(self):
     with self.assertRaises(Exception):
         utils.grant_domain_role(self.client, self.member_role.id,
                                 self.p2member.id, self.d1.id)
    def _grant_roles(self):
        # p1
        utils.grant_project_role(self.admin_client, self.project_admin_role.id,
                                 self.p1admin.id, self.p1.id)
        utils.grant_project_role(self.admin_client,
                                 self.project_member_role.id,
                                 self.p1member.id, self.p1.id)
        utils.grant_group_project_role(self.admin_client,
                                       self.project_member_role.id,
                                       self.g1.id, self.p1.id)

        # p2
        utils.grant_project_role(self.admin_client,
                                 self.project_admin_role.id,
                                 self.p2admin.id, self.p2.id)
        utils.grant_project_role(self.admin_client,
                                 self.project_member_role.id,
                                 self.p2member.id, self.p2.id)
        utils.grant_group_project_role(self.admin_client,
                                       self.project_member_role.id,
                                       self.g2.id, self.p2.id)
        # d1
        utils.grant_domain_role(self.admin_client,
                                self.domain_admin_role.id,
                                self.d1admin.id, self.d1.id)
        utils.grant_domain_role(self.admin_client,
                                self.member_role.id,
                                self.d1member.id, self.d1.id)
        utils.grant_domain_role(self.admin_client,
                                self.member_role.id,
                                self.p1admin.id, self.d1.id)
        utils.grant_domain_role(self.admin_client,
                                self.member_role.id,
                                self.p2admin.id, self.d2.id)
        utils.grant_domain_role(self.admin_client,
                                self.member_role.id,
                                self.p1member.id, self.d1.id)
        utils.grant_domain_role(self.admin_client,
                                self.member_role.id,
                                self.p2member.id, self.d2.id)