PermissionExtension

Handles permissions for a field.

Instantiate this as a field extension with all of the permissions you want to apply.

Note: Currently, this is automatically added to the field, when using field.permission_classes

This is deprecated behaviour, please manually add the extension to field.extensions

Constructor:

Initialize the permission extension.

Signature:

def __init__(
self,
permissions: List[BasePermission],
use_directives: bool = True,
fail_silently: bool = False,
) -> None:
...

Parameters:

  1. permissions:

    List of permissions to apply.

    Type
    List[BasePermission]
  2. use_directives:

    If True, add schema directives to the field.

    Type
    bool
    Default
    True
  3. fail_silently:

    If True, return None or [] instead of raising an exception. This is only valid for optional or list fields.

    Type
    bool
    Default
    False

Methods:

Attributes:

  1. permissions:

  2. fail_silently:

  3. return_empty_list:

  4. use_directives:

  5. supports_sync:

    Whether this extension can be resolved synchronously or not.

    The Permission extension always supports async checking using await_maybe, but only supports sync checking if there are no async permissions.

    Type
    bool