-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
DjangoPermissionExtension
does not support Channels requests.
#330
Comments
That's actually a general strawberry issue. Subscriptions doesn't support field extensions currently :( |
Just ran some tests, I think it is supported with raw strawberry. Based on what do you say that? i.e class FooExt(FieldExtension):
async def resolve_async(
self, next_: AsyncExtensionResolver, source: Any, info: Info, **kwargs: Any
) -> Any:
async for res in next_(source, info, **kwargs):
yield res + 20
@strawberry.type
class Subscription:
@strawberry.subscription(extensions=[FooExt()])
async def subscribe_requires_auth(self) -> AsyncGenerator[int, None]:
for i in range(5):
yield i
await asyncio.sleep(0.01) |
Hrm, I remember it not being supported, but maybe that changed? =P Will take a look at the PR you opened |
I think you are right |
The extension can probably check the "before" permissions (i.e. the global and root permissions), but the "after" ones (i.e. retval) are more complicated because there isn't a single return value for those. |
This should be fixed in https://github.com/strawberry-graphql/strawberry/releases/tag/0.240.0 Please let me know if that's not the case |
On Channels requests the context is a
dict
so you'll get anAttributeError
.https://github.com/strawberry-graphql/strawberry-graphql-django/blob/3a3a66e236acbc54ad7079ecfa2b92508f3ad60c/strawberry_django/permissions.py#L330
The text was updated successfully, but these errors were encountered: