Exemple #1
0
    def get(self, user_uuid):
        ListSchema = schemas.new_list_schema('type')
        list_params, errors = ListSchema().load(request.args)
        if errors:
            raise exceptions.InvalidListParamException(errors)

        items = self.external_auth_service.list_(user_uuid, **list_params)
        total = self.external_auth_service.count(user_uuid,
                                                 filtered=False,
                                                 **list_params)
        filtered = self.external_auth_service.count(user_uuid,
                                                    filtered=True,
                                                    **list_params)

        for item in items:
            plugin_info = current_app.config['external_auth_plugin_info'][
                item['type']]
            item['plugin_info'] = plugin_info

        response = {
            'filtered': filtered,
            'total': total,
            'items': items,
        }

        return response, 200
Exemple #2
0
    def get(self):
        scoping_tenant = Tenant.autodetect()
        ListSchema = schemas.new_list_schema('name')
        list_params, errors = ListSchema().load(request.args)
        if errors:
            raise exceptions.InvalidListParamException(errors)

        list_params['scoping_tenant_uuid'] = scoping_tenant.uuid

        policies = self.policy_service.list(**list_params)
        total = self.policy_service.count(**list_params)
        return {'items': policies, 'total': total}, 200
Exemple #3
0
    def get(self, group_uuid):
        scoping_tenant = Tenant.autodetect()

        self.group_service.assert_group_in_subtenant(scoping_tenant.uuid, group_uuid)

        ListSchema = schemas.new_list_schema('name')
        list_params, errors = ListSchema().load(request.args)
        if errors:
            raise exceptions.InvalidListParamException(errors)

        return {
            'items': self.group_service.list_policies(group_uuid, **list_params),
            'total': self.group_service.count_policies(group_uuid, filtered=False, **list_params),
            'filtered': self.group_service.count_policies(group_uuid, filtered=True, **list_params),
        }, 200
Exemple #4
0
    def get(self, user_uuid):
        logger.debug('listing user %s policies', user_uuid)
        ListSchema = schemas.new_list_schema('name')
        list_params, errors = ListSchema().load(request.args)
        if errors:
            raise exceptions.InvalidListParamException(errors)

        return {
            'items':
            self.user_service.list_policies(user_uuid, **list_params),
            'total':
            self.user_service.count_policies(user_uuid,
                                             filtered=False,
                                             **list_params),
            'filtered':
            self.user_service.count_policies(user_uuid,
                                             filtered=True,
                                             **list_params),
        }, 200
Exemple #5
0
    def get(self):
        scoping_tenant = Tenant.autodetect()
        ListSchema = schemas.new_list_schema('name')
        list_params, errors = ListSchema().load(request.args)
        if errors:
            raise exceptions.InvalidListParamException(errors)

        list_params['scoping_tenant_uuid'] = scoping_tenant.uuid

        groups = self.group_service.list_(**list_params)
        total = self.group_service.count(filtered=False, **list_params)
        filtered = self.group_service.count(filtered=True, **list_params)

        response = {
            'filtered': filtered,
            'total': total,
            'items': groups,
        }

        return response, 200
Exemple #6
0
    def get(self, tenant_uuid):
        scoping_tenant = Tenant.autodetect()
        ListSchema = schemas.new_list_schema('name')
        list_params, errors = ListSchema().load(request.args)
        if errors:
            raise exceptions.InvalidListParamException(errors)

        list_params['scoping_tenant_uuid'] = scoping_tenant.uuid
        total = self.tenant_service.count_policies(tenant_uuid,
                                                   filtered=False,
                                                   **list_params)
        filtered = self.tenant_service.count_policies(tenant_uuid,
                                                      filtered=True,
                                                      **list_params)

        return {
            'items': self.tenant_service.list_policies(tenant_uuid,
                                                       **list_params),
            'total': total,
            'filtered': filtered,
        }, 200
Exemple #7
0
    def get(self, tenant_uuid):
        scoping_tenant = Tenant.autodetect()
        ListSchema = schemas.new_list_schema('username')
        list_params, errors = ListSchema().load(request.args)
        if errors:
            raise exceptions.InvalidListParamException(errors)

        self.tenant_service.assert_tenant_under(scoping_tenant.uuid,
                                                tenant_uuid)

        return {
            'items':
            self.tenant_service.list_users(tenant_uuid, **list_params),
            'total':
            self.tenant_service.count_users(tenant_uuid,
                                            filtered=False,
                                            **list_params),
            'filtered':
            self.tenant_service.count_users(tenant_uuid,
                                            filtered=True,
                                            **list_params),
        }, 200