def _validate_access(self, backend, request): _ = self if not ApiToolbox.access_granted(request.client, user_rights=backend.user_rights, client_rights=backend.client_rights): raise HttpForbiddenException( error_description= 'The requesting client has no access to this Backend', error='no_ownership')
def list(self, request): """ Lists all available ALBA Backends: :param request: The raw request :type request: Request :return: All ALBA Backends for which the current user has permissions :rtype: list """ backends = AlbaBackendList.get_albabackends() allowed_backends = [] for alba_backend in backends: if ApiToolbox.access_granted( request.client, user_rights=alba_backend.backend.user_rights, client_rights=alba_backend.backend.client_rights): allowed_backends.append(alba_backend) return allowed_backends
def list(self, request, backend_type=None): """ Overview of all backends (from a certain type, if given) on the local node (or a remote one) :param request: The raw request :type request: Request :param backend_type: Optional BackendType code to filter :type backend_type: str """ if backend_type is None: possible_backends = BackendList.get_backends() else: possible_backends = BackendTypeList.get_backend_type_by_code( backend_type).backends backends = [] for backend in possible_backends: if ApiToolbox.access_granted(request.client, user_rights=backend.user_rights, client_rights=backend.client_rights): backends.append(backend) return backends