Beispiel #1
0
    def remove_user(self, group_uuid, user_uuid):
        nb_deleted = self._dao.group.remove_user(group_uuid, user_uuid)
        if nb_deleted:
            return

        if not self._dao.group.exists(group_uuid):
            raise exceptions.UnknownGroupException(group_uuid)

        if not self._dao.user.exists(user_uuid):
            raise exceptions.UnknownUserException(user_uuid)
Beispiel #2
0
    def remove_policy(self, group_uuid, policy_uuid):
        nb_deleted = self._dao.group.remove_policy(group_uuid, policy_uuid)
        if nb_deleted:
            return

        if not self._dao.group.exists(group_uuid):
            raise exceptions.UnknownGroupException(group_uuid)

        if not self._dao.policy.exists(policy_uuid):
            raise exceptions.UnknownPolicyException(policy_uuid)
Beispiel #3
0
    def get(self, group_uuid, scoping_tenant_uuid):
        args = {
            'uuid': group_uuid,
            'limit': 1,
            'tenant_uuids': self._tenant_tree.list_nodes(scoping_tenant_uuid)
        }

        matching_groups = self._dao.group.list_(**args)
        for group in matching_groups:
            return group

        raise exceptions.UnknownGroupException(group_uuid)
Beispiel #4
0
    def get(self, group_uuid, tenant_uuids):
        args = {
            'uuid': group_uuid,
            'limit': 1,
            'tenant_uuids': tenant_uuids,
        }

        matching_groups = self._dao.group.list_(**args)
        for group in matching_groups:
            return group

        raise exceptions.UnknownGroupException(group_uuid)
Beispiel #5
0
    def remove_user(self, group_uuid, user_uuid):
        if self._dao.group.is_system_managed(group_uuid):
            raise exceptions.SystemGroupForbidden(group_uuid)

        nb_deleted = self._dao.group.remove_user(group_uuid, user_uuid)
        if nb_deleted:
            return

        if not self._dao.group.exists(group_uuid):
            raise exceptions.UnknownGroupException(group_uuid)

        if not self._dao.user.exists(user_uuid):
            raise exceptions.UnknownUserException(user_uuid)
Beispiel #6
0
 def assert_group_in_subtenant(self, scoping_tenant_uuid, uuid):
     tenant_uuids = self._tenant_tree.list_nodes(scoping_tenant_uuid)
     exists = self._dao.group.exists(uuid, tenant_uuids=tenant_uuids)
     if not exists:
         raise exceptions.UnknownGroupException(uuid)
Beispiel #7
0
 def assert_group_in_subtenant(self, tenant_uuids, uuid):
     exists = self._dao.group.exists(uuid, tenant_uuids=tenant_uuids)
     if not exists:
         raise exceptions.UnknownGroupException(uuid)