strawberry.BasePermission

Base class for permissions. All permissions should inherit from this class.

Example:

from strawberry.permission import BasePermission
class IsAuthenticated(BasePermission):
message = "User is not authenticated"
def has_permission(self, source, info, **kwargs):
return info.context["user"].is_authenticated

Methods:

Attributes:

  1. message:

    Type
    str | None
  2. error_extensions:

    Type
    GraphQLErrorExtensions | None
  3. error_class:

    Type
    Type[GraphQLError]
  4. schema_directive:

    Type
    object