@​strawberry.type
class Query:
@​strawberry.field(extensions=[PermissionExtension(permissions=[IsAuthorized()])])
def name(self) -> str:
return "ABC"
The old way of adding permissions using permission_classes is still
supported via the automatic addition of a PermissionExtension on the field.
Using the new PermissionExtension API, permissions support even more features:
Silent errors
To return None or [] instead of raising an error, the fail_silently keyword
argument on PermissionExtension can be set to True.
Custom Error Extensions & classes
Permissions will now automatically add pre-defined error extensions to the error, and
can use a custom GraphQLError class. This can be configured by modifying
the error_class and error_extensions attributes on the BasePermission class.
Customizable Error Handling
To customize the error handling, the on_unauthorized method on
the BasePermission class can be used. Further changes can be implemented by
subclassing the PermissionExtension class.
Schema Directives
Permissions will automatically be added as schema directives to the schema. This
behavior can be altered by setting the add_directives to False
@​strawberry.type
class Query:
@​strawberry.field(extensions=[PermissionExtension(permissions=[IsAuthorized()])])
def name(self) -> str:
return "ABC"
The old way of adding permissions using permission_classes is still
supported via the automatic addition of a PermissionExtension on the field.
Using the new PermissionExtension API, permissions support even more features:
Silent errors
To return None or [] instead of raising an error, the fail_silently keyword
argument on PermissionExtension can be set to True.
Custom Error Extensions & classes
Permissions will now automatically add pre-defined error extensions to the error, and
can use a custom GraphQLError class. This can be configured by modifying
the error_class and error_extensions attributes on the BasePermission class.
Customizable Error Handling
To customize the error handling, the on_unauthorized method on
the BasePermission class can be used. Further changes can be implemented by
subclassing the PermissionExtension class.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Updates the requirements on strawberry-graphql[channels] to permit the latest version.
Release notes
Sourced from strawberry-graphql[channels]'s releases.
... (truncated)
Changelog
Sourced from strawberry-graphql[channels]'s changelog.
... (truncated)
Commits
528b1b3
Release 🍓 0.217.0599e3a3
refactor: Permissions using Field Extensions (#2570)5b5b717
Release 🍓 0.216.1a31b5c4
fix: relay.Node with overwritten resolve_id and without NodeId (#2844)6b84220
Release 🍓 0.216.075cb9ec
Override encode_json() method in Django BaseView to use DjangoJSONEncoder (#3...3c7b57d
Release 🍓 0.215.3fdb87ec
change: parse query params to use parse_json (#3272)f0332fc
Release 🍓 0.215.23e5c7f6
Allow to send cookies with apollo sandbox (#3278)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show