Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of permission_classes for type decorator #3433

Open
1 of 3 tasks
alexandru0-dev opened this issue Apr 2, 2024 · 0 comments
Open
1 of 3 tasks

Add support of permission_classes for type decorator #3433

alexandru0-dev opened this issue Apr 2, 2024 · 0 comments

Comments

@alexandru0-dev
Copy link

alexandru0-dev commented Apr 2, 2024

Feature Request Type

  • Core functionality
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

As the title describes, the strawberry.type decorator lacks the option to set global permission classes, making the code repetitive and highly verbose, improving also DX.

Making a whole query protected with the same permission would result like this:

Actual solution

@strawberry.type
class Query:
    user: str = strawberry.field(permission_classes=[IsAuthenticated])
    x1: str = strawberry.field(permission_classes=[IsAuthenticated])
    x2: str = strawberry.field(permission_classes=[IsAuthenticated])
    x3: str = strawberry.field(permission_classes=[IsAuthenticated])
    x4: str = strawberry.field(permission_classes=[IsAuthenticated]) 

Desired solution

@strawberry.type(permission_classes=[IsAuthenticated])
class Query:
    user: str
    x1: str
    x2: str
    x3: str

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant