-------------------
This release improves support for permissions (it is a breaking change).
Now you will receive the source and the arguments in the `has_permission` method,
so you can run more complex permission checks. It also allows to use permissions
on fields, here's an example:
python
import strawberry
from strawberry.permission import BasePermission
class IsAdmin(BasePermission):
message = "You are not authorized"
def has_permission(self, source, info):
return source.name.lower() == "Patrick" or _is_admin(info)
strawberry.type
class User:
name: str
email: str = strawberry.field(permission_classes=[IsAdmin])
strawberry.type
class Query:
strawberry.field(permission_classes=[IsAdmin])
def user(self, info) -> str:
return User(name="Patrick", email="exampleemail.com")