strawberry-graphql 0.229.2__tar.gz → 0.229.2.dev1715873118__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/PKG-INFO +1 -1
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/pyproject.toml +1 -1
- strawberry_graphql-0.229.2.dev1715873118/strawberry/permission.py +319 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/typing.py +1 -1
- strawberry_graphql-0.229.2/strawberry/permission.py +0 -187
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/LICENSE +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/README.md +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/__main__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/aiohttp/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/aiohttp/handlers/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/aiohttp/handlers/graphql_transport_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/aiohttp/handlers/graphql_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/aiohttp/test/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/aiohttp/test/client.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/aiohttp/views.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/annotation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/arguments.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/asgi/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/asgi/handlers/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/asgi/handlers/graphql_transport_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/asgi/handlers/graphql_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/asgi/test/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/asgi/test/client.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/auto.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/chalice/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/chalice/views.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/channels/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/channels/handlers/base.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/channels/handlers/graphql_transport_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/channels/handlers/graphql_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/channels/handlers/http_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/channels/handlers/ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/channels/router.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/channels/testing.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/app.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/commands/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/commands/codegen.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/commands/export_schema.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/commands/schema_codegen.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/commands/server.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/commands/upgrade/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/commands/upgrade/_fake_progress.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/commands/upgrade/_run_codemod.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/constants.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/debug_server.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/utils/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/utils/load_schema.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/exceptions.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/plugins/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/plugins/print_operation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/plugins/python.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/plugins/typescript.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/query_codegen.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codemods/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codemods/annotated_unions.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/custom_scalar.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/dataloader.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/directive.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/django/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/django/apps.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/django/context.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/django/test/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/django/test/client.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/django/views.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/enum.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/conflicting_arguments.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/duplicated_type_name.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/exception.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/exception_source.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/invalid_argument_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/invalid_union_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/missing_arguments_annotations.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/missing_field_annotation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/missing_return_annotation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/not_a_strawberry_enum.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/object_is_not_a_class.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/object_is_not_an_enum.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/permission_fail_silently_requires_optional.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/private_strawberry_field.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/scalar_already_registered.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/syntax.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/unresolved_field_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/utils/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/exceptions/utils/source_finder.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/_compat.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/conversion.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/conversion_types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/error_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/exceptions.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/fields.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/object_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/experimental/pydantic/utils.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/ext/LICENSE +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/ext/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/ext/dataclasses/LICENSE +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/ext/dataclasses/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/ext/dataclasses/dataclasses.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/ext/mypy_plugin.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/add_validation_rules.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/base_extension.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/context.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/directives.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/disable_validation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/field_extension.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/mask_errors.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/max_aliases.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/max_tokens.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/parser_cache.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/pyinstrument.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/query_depth_limiter.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/runner.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/tracing/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/tracing/apollo.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/tracing/datadog.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/tracing/opentelemetry.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/tracing/sentry.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/tracing/utils.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/utils.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/extensions/validation_cache.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/fastapi/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/fastapi/context.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/fastapi/handlers/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/fastapi/handlers/graphql_transport_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/fastapi/handlers/graphql_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/fastapi/router.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/argument.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/enum.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/field.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/mutation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/object_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/scalar.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/schema.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/schema_directive.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/schema_directives.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/federation/union.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/field.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/field_extensions/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/field_extensions/input_mutation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/file_uploads/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/file_uploads/scalars.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/file_uploads/utils.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/flask/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/flask/views.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/async_base_view.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/base.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/exceptions.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/ides.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/sync_base_view.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/temporal_response.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/http/typevars.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/lazy_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/litestar/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/litestar/controller.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/litestar/handlers/graphql_transport_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/litestar/handlers/graphql_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/mutation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/object_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/parent.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/printer/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/printer/ast_from_value.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/printer/printer.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/private.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/py.typed +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/quart/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/quart/views.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/relay/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/relay/exceptions.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/relay/fields.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/relay/types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/relay/utils.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/resolvers.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/sanic/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/sanic/context.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/sanic/utils.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/sanic/views.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/scalars.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/base.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/compat.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/config.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/exceptions.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/execute.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/name_converter.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/schema.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/schema_converter.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/types/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/types/base_scalars.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/types/concrete_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema/types/scalar.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema_codegen/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/schema_directive.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/starlite/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/starlite/controller.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/starlite/handlers/graphql_transport_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/starlite/handlers/graphql_ws_handler.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/static/apollo-sandbox.html +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/static/graphiql.html +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/static/pathfinder.html +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/subscriptions/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/subscriptions/protocols/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/subscriptions/protocols/graphql_ws/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/subscriptions/protocols/graphql_ws/handlers.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/subscriptions/protocols/graphql_ws/types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/test/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/test/client.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/tools/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/tools/create_type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/tools/merge_types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/type.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/execution.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/fields/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/fields/resolver.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/graphql.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/info.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/nodes.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/type_resolver.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/types/types.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/union.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/unset.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/__init__.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/aio.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/await_maybe.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/dataclasses.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/debug.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/deprecations.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/graphql_lexer.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/importer.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/inspect.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/logging.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/operation.py +0 -0
- {strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/str_converters.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "strawberry-graphql"
|
3
3
|
packages = [ { include = "strawberry" } ]
|
4
|
-
version = "0.229.2"
|
4
|
+
version = "0.229.2.dev.1715873118"
|
5
5
|
description = "A library for creating GraphQL APIs"
|
6
6
|
authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
|
7
7
|
license = "MIT"
|
@@ -0,0 +1,319 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import abc
|
4
|
+
import inspect
|
5
|
+
from functools import cached_property
|
6
|
+
from inspect import iscoroutinefunction
|
7
|
+
from typing import (
|
8
|
+
TYPE_CHECKING,
|
9
|
+
Any,
|
10
|
+
Awaitable,
|
11
|
+
List,
|
12
|
+
Literal,
|
13
|
+
Optional,
|
14
|
+
Tuple,
|
15
|
+
Type,
|
16
|
+
Union,
|
17
|
+
)
|
18
|
+
from typing_extensions import deprecated
|
19
|
+
|
20
|
+
from strawberry.exceptions import StrawberryGraphQLError
|
21
|
+
from strawberry.exceptions.permission_fail_silently_requires_optional import (
|
22
|
+
PermissionFailSilentlyRequiresOptionalError,
|
23
|
+
)
|
24
|
+
from strawberry.extensions import FieldExtension
|
25
|
+
from strawberry.schema_directive import Location, StrawberrySchemaDirective
|
26
|
+
from strawberry.type import StrawberryList, StrawberryOptional
|
27
|
+
from strawberry.utils.await_maybe import await_maybe
|
28
|
+
|
29
|
+
if TYPE_CHECKING:
|
30
|
+
from graphql import GraphQLError, GraphQLErrorExtensions
|
31
|
+
|
32
|
+
from strawberry.extensions.field_extension import (
|
33
|
+
AsyncExtensionResolver,
|
34
|
+
SyncExtensionResolver,
|
35
|
+
)
|
36
|
+
from strawberry.field import StrawberryField
|
37
|
+
from strawberry.types import Info
|
38
|
+
|
39
|
+
|
40
|
+
class BasePermission(abc.ABC):
|
41
|
+
"""
|
42
|
+
Base class for creating permissions
|
43
|
+
"""
|
44
|
+
|
45
|
+
message: Optional[str] = None
|
46
|
+
|
47
|
+
error_extensions: Optional[GraphQLErrorExtensions] = None
|
48
|
+
|
49
|
+
error_class: Type[GraphQLError] = StrawberryGraphQLError
|
50
|
+
|
51
|
+
_schema_directive: Optional[object] = None
|
52
|
+
|
53
|
+
@abc.abstractmethod
|
54
|
+
def has_permission(
|
55
|
+
self, source: Any, info: Info, **kwargs: Any
|
56
|
+
) -> Union[
|
57
|
+
bool,
|
58
|
+
Awaitable[bool],
|
59
|
+
Tuple[Literal[False], dict],
|
60
|
+
Awaitable[Tuple[Literal[False], dict]],
|
61
|
+
]:
|
62
|
+
"""
|
63
|
+
This method is a required override in the permission class. It checks if the user has the necessary permissions to access a specific field.
|
64
|
+
|
65
|
+
The method should return a boolean value:
|
66
|
+
- True: The user has the necessary permissions.
|
67
|
+
- False: The user does not have the necessary permissions. In this case, the `on_unauthorized` method will be invoked.
|
68
|
+
|
69
|
+
Avoid raising exceptions in this method. Instead, use the `on_unauthorized` method to handle errors and customize the error response.
|
70
|
+
|
71
|
+
If there's a need to pass additional information to the `on_unauthorized` method, return a tuple. The first element should be False, and the second element should be a dictionary containing the additional information.
|
72
|
+
|
73
|
+
Args:
|
74
|
+
source (Any): The source field that the permission check is being performed on.
|
75
|
+
info (Info): The GraphQL resolve info associated with the field.
|
76
|
+
**kwargs (Any): Additional arguments that are typically passed to the field resolver.
|
77
|
+
|
78
|
+
Returns:
|
79
|
+
bool or tuple: Returns True if the user has the necessary permissions. Returns False or a tuple (False, additional_info) if the user does not have the necessary permissions. In the latter case, the `on_unauthorized` method will be invoked.
|
80
|
+
"""
|
81
|
+
raise NotImplementedError(
|
82
|
+
"Permission classes should override has_permission method"
|
83
|
+
)
|
84
|
+
|
85
|
+
def on_unauthorized(self, **kwargs: Any) -> None:
|
86
|
+
"""
|
87
|
+
Default error raising for permissions.
|
88
|
+
This can be overridden to customize the behavior.
|
89
|
+
"""
|
90
|
+
# Instantiate error class
|
91
|
+
error = self.error_class(self.message or "")
|
92
|
+
|
93
|
+
if self.error_extensions:
|
94
|
+
# Add our extensions to the error
|
95
|
+
if not error.extensions:
|
96
|
+
error.extensions = dict()
|
97
|
+
error.extensions.update(self.error_extensions)
|
98
|
+
|
99
|
+
raise error
|
100
|
+
|
101
|
+
@property
|
102
|
+
@deprecated(
|
103
|
+
"@schema_directive is deprecated and will be disabled by default on 31.12.2024 with future removal planned. Use the new @permissions directive instead."
|
104
|
+
)
|
105
|
+
def schema_directive(self) -> object:
|
106
|
+
if not self._schema_directive:
|
107
|
+
|
108
|
+
class AutoDirective:
|
109
|
+
__strawberry_directive__ = StrawberrySchemaDirective(
|
110
|
+
self.__class__.__name__,
|
111
|
+
self.__class__.__name__,
|
112
|
+
[Location.FIELD_DEFINITION],
|
113
|
+
[],
|
114
|
+
)
|
115
|
+
|
116
|
+
self._schema_directive = AutoDirective()
|
117
|
+
|
118
|
+
return self._schema_directive
|
119
|
+
|
120
|
+
@cached_property
|
121
|
+
def is_async(self) -> bool:
|
122
|
+
return iscoroutinefunction(self.has_permission)
|
123
|
+
|
124
|
+
def __and__(self, other: BasePermission):
|
125
|
+
return AndPermission([self, other])
|
126
|
+
|
127
|
+
def __or__(self, other: BasePermission):
|
128
|
+
return OrPermission([self, other])
|
129
|
+
|
130
|
+
|
131
|
+
class CompositePermission(BasePermission, abc.ABC):
|
132
|
+
def __init__(self, child_permissions: List[BasePermission]):
|
133
|
+
self.child_permissions = child_permissions
|
134
|
+
|
135
|
+
def on_unauthorized(self, **kwargs: Any) -> Any:
|
136
|
+
failed_permissions = kwargs.get("failed_permissions", [])
|
137
|
+
for permission in failed_permissions:
|
138
|
+
permission.on_unauthorized()
|
139
|
+
|
140
|
+
@cached_property
|
141
|
+
def is_async(self) -> bool:
|
142
|
+
return any(x.is_async for x in self.child_permissions)
|
143
|
+
|
144
|
+
|
145
|
+
class AndPermission(CompositePermission):
|
146
|
+
def has_permission(
|
147
|
+
self, source: Any, info: Info, **kwargs: Any
|
148
|
+
) -> Union[
|
149
|
+
bool,
|
150
|
+
Awaitable[bool],
|
151
|
+
Tuple[Literal[False], dict],
|
152
|
+
Awaitable[Tuple[Literal[False], dict]],
|
153
|
+
]:
|
154
|
+
if self.is_async:
|
155
|
+
return self._has_permission_async(source, info, **kwargs)
|
156
|
+
|
157
|
+
for permission in self.child_permissions:
|
158
|
+
if not permission.has_permission(source, info, **kwargs):
|
159
|
+
return False, {"failed_permissions": [permission]}
|
160
|
+
return True
|
161
|
+
|
162
|
+
async def _has_permission_async(
|
163
|
+
self, source: Any, info: Info, **kwargs: Any
|
164
|
+
) -> Union[bool, Tuple[Literal[False], dict]]:
|
165
|
+
for permission in self.child_permissions:
|
166
|
+
if not await await_maybe(permission.has_permission(source, info, **kwargs)):
|
167
|
+
return False, {"failed_permissions": [permission]}
|
168
|
+
return True
|
169
|
+
|
170
|
+
def __and__(self, other: BasePermission):
|
171
|
+
return AndPermission([*self.child_permissions, other])
|
172
|
+
|
173
|
+
|
174
|
+
class OrPermission(CompositePermission):
|
175
|
+
def has_permission(
|
176
|
+
self, source: Any, info: Info, **kwargs: Any
|
177
|
+
) -> Union[
|
178
|
+
bool,
|
179
|
+
Awaitable[bool],
|
180
|
+
Tuple[Literal[False], dict],
|
181
|
+
Awaitable[Tuple[Literal[False], dict]],
|
182
|
+
]:
|
183
|
+
if self.is_async:
|
184
|
+
return self._has_permission_async(source, info, **kwargs)
|
185
|
+
failed_permissions = []
|
186
|
+
for permission in self.child_permissions:
|
187
|
+
if permission.has_permission(source, info, **kwargs):
|
188
|
+
return True
|
189
|
+
failed_permissions.append(permission)
|
190
|
+
|
191
|
+
return False, {"failed_permissions": failed_permissions}
|
192
|
+
|
193
|
+
async def _has_permission_async(
|
194
|
+
self, source: Any, info: Info, **kwargs: Any
|
195
|
+
) -> Union[bool, Tuple[Literal[False], dict]]:
|
196
|
+
failed_permissions = []
|
197
|
+
for permission in self.child_permissions:
|
198
|
+
if await await_maybe(permission.has_permission(source, info, **kwargs)):
|
199
|
+
return True
|
200
|
+
failed_permissions.append(permission)
|
201
|
+
|
202
|
+
return False, {"failed_permissions": failed_permissions}
|
203
|
+
|
204
|
+
def __or__(self, other: BasePermission):
|
205
|
+
return OrPermission([*self.child_permissions, other])
|
206
|
+
|
207
|
+
|
208
|
+
class PermissionExtension(FieldExtension):
|
209
|
+
"""
|
210
|
+
Handles permissions for a field
|
211
|
+
Instantiate this as a field extension with all of the permissions you want to apply
|
212
|
+
|
213
|
+
fail_silently: bool = False will return None or [] if the permission fails
|
214
|
+
instead of raising an exception. This is only valid for optional or list fields.
|
215
|
+
|
216
|
+
NOTE:
|
217
|
+
Currently, this is automatically added to the field, when using
|
218
|
+
field.permission_classes. You are free to use whichever method you prefer.
|
219
|
+
Use PermissionExtension if you want additional customization.
|
220
|
+
"""
|
221
|
+
|
222
|
+
def __init__(
|
223
|
+
self,
|
224
|
+
permissions: List[BasePermission],
|
225
|
+
use_directives: bool = True,
|
226
|
+
fail_silently: bool = False,
|
227
|
+
) -> None:
|
228
|
+
self.permissions = permissions
|
229
|
+
self.fail_silently = fail_silently
|
230
|
+
self.return_empty_list = False
|
231
|
+
self.use_directives = use_directives
|
232
|
+
|
233
|
+
def apply(self, field: StrawberryField) -> None:
|
234
|
+
"""
|
235
|
+
Applies all the permission directives to the schema
|
236
|
+
and sets up silent permissions
|
237
|
+
"""
|
238
|
+
if self.use_directives:
|
239
|
+
field.directives.extend(
|
240
|
+
[
|
241
|
+
p.schema_directive
|
242
|
+
for p in self.permissions
|
243
|
+
if not isinstance(p, CompositePermission)
|
244
|
+
]
|
245
|
+
)
|
246
|
+
# We can only fail silently if the field is optional or a list
|
247
|
+
if self.fail_silently:
|
248
|
+
if isinstance(field.type, StrawberryOptional):
|
249
|
+
if isinstance(field.type.of_type, StrawberryList):
|
250
|
+
self.return_empty_list = True
|
251
|
+
elif isinstance(field.type, StrawberryList):
|
252
|
+
self.return_empty_list = True
|
253
|
+
else:
|
254
|
+
raise PermissionFailSilentlyRequiresOptionalError(field)
|
255
|
+
|
256
|
+
def _on_unauthorized(self, permission: BasePermission, **kwargs: Any) -> Any:
|
257
|
+
if self.fail_silently:
|
258
|
+
return [] if self.return_empty_list else None
|
259
|
+
|
260
|
+
if kwargs in (None, {}):
|
261
|
+
return permission.on_unauthorized()
|
262
|
+
return permission.on_unauthorized(**kwargs)
|
263
|
+
|
264
|
+
def resolve(
|
265
|
+
self,
|
266
|
+
next_: SyncExtensionResolver,
|
267
|
+
source: Any,
|
268
|
+
info: Info,
|
269
|
+
**kwargs: Any[str, Any],
|
270
|
+
) -> Any:
|
271
|
+
"""
|
272
|
+
Checks if the permission should be accepted and
|
273
|
+
raises an exception if not
|
274
|
+
"""
|
275
|
+
|
276
|
+
for permission in self.permissions:
|
277
|
+
permission_response = permission.has_permission(source, info, **kwargs)
|
278
|
+
|
279
|
+
context = {}
|
280
|
+
if isinstance(permission_response, tuple):
|
281
|
+
has_permission, context = permission_response
|
282
|
+
else:
|
283
|
+
has_permission = permission_response
|
284
|
+
|
285
|
+
if not has_permission:
|
286
|
+
return self._on_unauthorized(permission, **context)
|
287
|
+
|
288
|
+
return next_(source, info, **kwargs)
|
289
|
+
|
290
|
+
async def resolve_async(
|
291
|
+
self,
|
292
|
+
next_: AsyncExtensionResolver,
|
293
|
+
source: Any,
|
294
|
+
info: Info,
|
295
|
+
**kwargs: Any[str, Any],
|
296
|
+
) -> Any:
|
297
|
+
for permission in self.permissions:
|
298
|
+
permission_response = await await_maybe(
|
299
|
+
permission.has_permission(source, info, **kwargs)
|
300
|
+
)
|
301
|
+
|
302
|
+
context = {}
|
303
|
+
if isinstance(permission_response, tuple):
|
304
|
+
has_permission, context = permission_response
|
305
|
+
else:
|
306
|
+
has_permission = permission_response
|
307
|
+
|
308
|
+
if not has_permission:
|
309
|
+
return self._on_unauthorized(permission, **context)
|
310
|
+
next = next_(source, info, **kwargs)
|
311
|
+
if inspect.isasyncgen(next):
|
312
|
+
return next
|
313
|
+
return await next
|
314
|
+
|
315
|
+
@cached_property
|
316
|
+
def supports_sync(self) -> bool:
|
317
|
+
"""The Permission extension always supports async checking using await_maybe,
|
318
|
+
but only supports sync checking if there are no async permissions"""
|
319
|
+
return all(not permission.is_async for permission in self.permissions)
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/utils/typing.py
RENAMED
@@ -302,7 +302,7 @@ def _get_namespace_from_ast(
|
|
302
302
|
# here to resolve lazy types by execing the annotated args, resolving the
|
303
303
|
# type directly and then adding it to extra namespace, so that _eval_type
|
304
304
|
# can properly resolve it later
|
305
|
-
type_name = args[0].strip(
|
305
|
+
type_name = args[0].strip()
|
306
306
|
for arg in args[1:]:
|
307
307
|
evaled_arg = eval(arg, globalns, localns) # noqa: PGH001, S307
|
308
308
|
if isinstance(evaled_arg, StrawberryLazyReference):
|
@@ -1,187 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
import abc
|
4
|
-
import inspect
|
5
|
-
from functools import cached_property
|
6
|
-
from inspect import iscoroutinefunction
|
7
|
-
from typing import (
|
8
|
-
TYPE_CHECKING,
|
9
|
-
Any,
|
10
|
-
Awaitable,
|
11
|
-
Dict,
|
12
|
-
List,
|
13
|
-
Optional,
|
14
|
-
Type,
|
15
|
-
Union,
|
16
|
-
)
|
17
|
-
|
18
|
-
from strawberry.exceptions import StrawberryGraphQLError
|
19
|
-
from strawberry.exceptions.permission_fail_silently_requires_optional import (
|
20
|
-
PermissionFailSilentlyRequiresOptionalError,
|
21
|
-
)
|
22
|
-
from strawberry.extensions import FieldExtension
|
23
|
-
from strawberry.schema_directive import Location, StrawberrySchemaDirective
|
24
|
-
from strawberry.type import StrawberryList, StrawberryOptional
|
25
|
-
from strawberry.utils.await_maybe import await_maybe
|
26
|
-
|
27
|
-
if TYPE_CHECKING:
|
28
|
-
from graphql import GraphQLError, GraphQLErrorExtensions
|
29
|
-
|
30
|
-
from strawberry.extensions.field_extension import (
|
31
|
-
AsyncExtensionResolver,
|
32
|
-
SyncExtensionResolver,
|
33
|
-
)
|
34
|
-
from strawberry.field import StrawberryField
|
35
|
-
from strawberry.types import Info
|
36
|
-
|
37
|
-
|
38
|
-
class BasePermission(abc.ABC):
|
39
|
-
"""
|
40
|
-
Base class for creating permissions
|
41
|
-
"""
|
42
|
-
|
43
|
-
message: Optional[str] = None
|
44
|
-
|
45
|
-
error_extensions: Optional[GraphQLErrorExtensions] = None
|
46
|
-
|
47
|
-
error_class: Type[GraphQLError] = StrawberryGraphQLError
|
48
|
-
|
49
|
-
_schema_directive: Optional[object] = None
|
50
|
-
|
51
|
-
@abc.abstractmethod
|
52
|
-
def has_permission(
|
53
|
-
self, source: Any, info: Info, **kwargs: Any
|
54
|
-
) -> Union[bool, Awaitable[bool]]:
|
55
|
-
raise NotImplementedError(
|
56
|
-
"Permission classes should override has_permission method"
|
57
|
-
)
|
58
|
-
|
59
|
-
def on_unauthorized(self) -> None:
|
60
|
-
"""
|
61
|
-
Default error raising for permissions.
|
62
|
-
This can be overridden to customize the behavior.
|
63
|
-
"""
|
64
|
-
|
65
|
-
# Instantiate error class
|
66
|
-
error = self.error_class(self.message or "")
|
67
|
-
|
68
|
-
if self.error_extensions:
|
69
|
-
# Add our extensions to the error
|
70
|
-
if not error.extensions:
|
71
|
-
error.extensions = dict()
|
72
|
-
error.extensions.update(self.error_extensions)
|
73
|
-
|
74
|
-
raise error
|
75
|
-
|
76
|
-
@property
|
77
|
-
def schema_directive(self) -> object:
|
78
|
-
if not self._schema_directive:
|
79
|
-
|
80
|
-
class AutoDirective:
|
81
|
-
__strawberry_directive__ = StrawberrySchemaDirective(
|
82
|
-
self.__class__.__name__,
|
83
|
-
self.__class__.__name__,
|
84
|
-
[Location.FIELD_DEFINITION],
|
85
|
-
[],
|
86
|
-
)
|
87
|
-
|
88
|
-
self._schema_directive = AutoDirective()
|
89
|
-
|
90
|
-
return self._schema_directive
|
91
|
-
|
92
|
-
|
93
|
-
class PermissionExtension(FieldExtension):
|
94
|
-
"""
|
95
|
-
Handles permissions for a field
|
96
|
-
Instantiate this as a field extension with all of the permissions you want to apply
|
97
|
-
|
98
|
-
fail_silently: bool = False will return None or [] if the permission fails
|
99
|
-
instead of raising an exception. This is only valid for optional or list fields.
|
100
|
-
|
101
|
-
NOTE:
|
102
|
-
Currently, this is automatically added to the field, when using
|
103
|
-
field.permission_classes
|
104
|
-
This is deprecated behavior, please manually add the extension to field.extensions
|
105
|
-
"""
|
106
|
-
|
107
|
-
def __init__(
|
108
|
-
self,
|
109
|
-
permissions: List[BasePermission],
|
110
|
-
use_directives: bool = True,
|
111
|
-
fail_silently: bool = False,
|
112
|
-
) -> None:
|
113
|
-
self.permissions = permissions
|
114
|
-
self.fail_silently = fail_silently
|
115
|
-
self.return_empty_list = False
|
116
|
-
self.use_directives = use_directives
|
117
|
-
|
118
|
-
def apply(self, field: StrawberryField) -> None:
|
119
|
-
"""
|
120
|
-
Applies all of the permission directives to the schema
|
121
|
-
and sets up silent permissions
|
122
|
-
"""
|
123
|
-
if self.use_directives:
|
124
|
-
field.directives.extend(
|
125
|
-
p.schema_directive for p in self.permissions if p.schema_directive
|
126
|
-
)
|
127
|
-
# We can only fail silently if the field is optional or a list
|
128
|
-
if self.fail_silently:
|
129
|
-
if isinstance(field.type, StrawberryOptional):
|
130
|
-
if isinstance(field.type.of_type, StrawberryList):
|
131
|
-
self.return_empty_list = True
|
132
|
-
elif isinstance(field.type, StrawberryList):
|
133
|
-
self.return_empty_list = True
|
134
|
-
else:
|
135
|
-
errror = PermissionFailSilentlyRequiresOptionalError(field)
|
136
|
-
raise errror
|
137
|
-
|
138
|
-
def _on_unauthorized(self, permission: BasePermission) -> Any:
|
139
|
-
if self.fail_silently:
|
140
|
-
return [] if self.return_empty_list else None
|
141
|
-
return permission.on_unauthorized()
|
142
|
-
|
143
|
-
def resolve(
|
144
|
-
self,
|
145
|
-
next_: SyncExtensionResolver,
|
146
|
-
source: Any,
|
147
|
-
info: Info,
|
148
|
-
**kwargs: Dict[str, Any],
|
149
|
-
) -> Any:
|
150
|
-
"""
|
151
|
-
Checks if the permission should be accepted and
|
152
|
-
raises an exception if not
|
153
|
-
"""
|
154
|
-
for permission in self.permissions:
|
155
|
-
if not permission.has_permission(source, info, **kwargs):
|
156
|
-
return self._on_unauthorized(permission)
|
157
|
-
return next_(source, info, **kwargs)
|
158
|
-
|
159
|
-
async def resolve_async(
|
160
|
-
self,
|
161
|
-
next_: AsyncExtensionResolver,
|
162
|
-
source: Any,
|
163
|
-
info: Info,
|
164
|
-
**kwargs: Dict[str, Any],
|
165
|
-
) -> Any:
|
166
|
-
for permission in self.permissions:
|
167
|
-
has_permission = await await_maybe(
|
168
|
-
permission.has_permission(source, info, **kwargs)
|
169
|
-
)
|
170
|
-
|
171
|
-
if not has_permission:
|
172
|
-
return self._on_unauthorized(permission)
|
173
|
-
next = next_(source, info, **kwargs)
|
174
|
-
if inspect.isasyncgen(next):
|
175
|
-
return next
|
176
|
-
return await next
|
177
|
-
|
178
|
-
@cached_property
|
179
|
-
def supports_sync(self) -> bool:
|
180
|
-
"""The Permission extension always supports async checking using await_maybe,
|
181
|
-
but only supports sync checking if there are no async permissions"""
|
182
|
-
async_permissions = [
|
183
|
-
True
|
184
|
-
for permission in self.permissions
|
185
|
-
if iscoroutinefunction(permission.has_permission)
|
186
|
-
]
|
187
|
-
return len(async_permissions) == 0
|
File without changes
|
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/__init__.py
RENAMED
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/__main__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/aiohttp/views.py
RENAMED
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/annotation.py
RENAMED
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/arguments.py
RENAMED
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/asgi/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/chalice/views.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/__init__.py
RENAMED
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/app.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/cli/constants.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{strawberry_graphql-0.229.2 → strawberry_graphql-0.229.2.dev1715873118}/strawberry/codegen/types.py
RENAMED
File without changes
|
File without changes
|