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_authenticatedMethods:
-  has_permissionCheck if the permission should be accepted. This method should be overridden by the subclasses. Signature:def has_permission(self, source: Any, info: Info, kwargs: Any = {}) -> bool | Awaitable[bool]:...Parameters:-  source:- Type
-  Any
 
-  info:- Type
-  Info
 
-  kwargs:- Type
-  Any
- Default
-  {}
 
 
-  
-  on_unauthorizedDefault error raising for permissions. This method can be overridden to customize the error raised when the permission is not granted. Example: from strawberry.permission import BasePermissionclass CustomPermissionError(PermissionError):passclass IsAuthenticated(BasePermission):message = "User is not authenticated"def has_permission(self, source, info, **kwargs):return info.context["user"].is_authenticateddef on_unauthorized(self) -> None:raise CustomPermissionError(self.message)Signature:def on_unauthorized(self) -> None:...
Attributes:
-  message:- Type
-  str | None
 
-  error_extensions:- Type
-  GraphQLErrorExtensions | None
 
-  error_class:- Type
-  Type[GraphQLError]
 
-  schema_directive:- Type
-  object