django-pfx 1.4.dev70__tar.gz → 1.4.dev72__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.
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/PKG-INFO +1 -1
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/django_pfx.egg-info/PKG-INFO +1 -1
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/django_pfx.egg-info/SOURCES.txt +1 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/decorator/rest.py +3 -3
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/rest_views.py +7 -1
- django_pfx-1.4.dev72/tests/migrations/0002_alter_author_options.py +18 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/models.py +1 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_permissions.py +46 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/views.py +9 -1
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/.gitignore +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/.gitlab-ci.yml +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/.pre-commit-config.yaml +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/LICENSE +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/MANIFEST.in +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/README.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/django_pfx.egg-info/dependency_links.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/django_pfx.egg-info/requires.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/django_pfx.egg-info/top_level.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/Makefile +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/conf.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/index.rst +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/api.views.rst +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/authentication.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/decorator.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/generate_openapi.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/getting_started.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/internationalisation.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/model.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/pfx_views.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/profiling.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/settings.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/doc/source/testing.md +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/img/pfx.png +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/img/pfx.svg +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/make_messages +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/manage.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/apidoc/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/apidoc/parameters.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/apidoc/schema.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/apidoc/tags.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/apps.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/decorator/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/default_settings.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/exceptions.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/fields.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/http/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/http/json_response.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/locale/fr/LC_MESSAGES/django.mo +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/locale/fr/LC_MESSAGES/django.po +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/management/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/management/commands/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/management/commands/makeapidoc.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/management/commands/profile.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/middleware/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/middleware/authentication.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/middleware/locale.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/middleware/profiling.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/migrations/0001_initial.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/migrations/0002_pfxpermissionsuser.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/migrations/0003_delete_pfxpermissionsuser.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/migrations/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/abstract_pfx_base_user.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/cache_mixins.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/login_ban.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/not_null_fields.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/otp_user_mixin.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/pfx_models.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/pfx_user.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/user_filtered_queryset_mixin.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/serializers/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/serializers/json.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/settings.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/shortcuts.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/storage/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/storage/s3_storage.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/otp_code_email.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/otp_code_subject.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/password_reset_email.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/password_reset_subject.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/welcome_email.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/welcome_subject.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/test.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/urls.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/authentication_views.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/fields.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/filters_views.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/locale_views.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/date_format.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/groups.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/list_count.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/list_items.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/list_mode.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/list_order.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/list_search.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/media_redirect.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/meta_fields.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/meta_filters.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/meta_orders.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/subset.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/subset_limit.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/subset_offset.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/subset_page.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/subset_page_size.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/subset_page_subset.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/settings/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/settings/dev.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pyproject.toml +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/requirements.txt +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/serve-doc +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/setup.cfg +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/setup.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/locale/fr/LC_MESSAGES/django.po +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/migrations/0001_initial.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/migrations/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/settings/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/settings/ci.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/settings/common.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/settings/dev.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/settings/dev_custom_example.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/settings/dev_default.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/basic_api_errors.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/basic_api_test.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_api_doc.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_api_doc_search.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_auth_api.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_body_mixin.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_cache.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_client.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_fields.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_filters.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_locale_api.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_perm_tests.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_perms_api.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_profiling_middleware.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_settings.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_shortcuts.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_timezone_middleware.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_tools.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_user_queryset.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_view_decorators.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/tests/test_view_fields.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests/urls.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/migrations/0001_initial.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/migrations/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/settings/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/settings/ci.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/settings/common.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/settings/dev.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/settings/dev_custom_example.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/settings/dev_default.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/tests/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/tests/test_api.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/tests/test_auth_api.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/urls.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/views.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/migrations/0001_initial.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/migrations/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/models.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/settings/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/settings/ci.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/settings/common.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/settings/dev.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/settings/dev_custom_example.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/settings/dev_default.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/tests/__init__.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/tests/test_api.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/tests/test_auth_api.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/urls.py +0 -0
- {django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/views.py +0 -0
|
@@ -14,8 +14,8 @@ logger = logging.getLogger(__name__)
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def rest_api(
|
|
17
|
-
path, method='get', public=None,
|
|
18
|
-
parameters=None,
|
|
17
|
+
path, method='get', public=None, perms=None,
|
|
18
|
+
priority=0, priority_doc=0, parameters=None,
|
|
19
19
|
request_schema=None, response_schema=None, filters=False,
|
|
20
20
|
search=False, groups=None):
|
|
21
21
|
def decorator(func):
|
|
@@ -31,7 +31,7 @@ def rest_api(
|
|
|
31
31
|
'HTTP_X_PRINT_REQUEST' in request.META):
|
|
32
32
|
print(format_request(request))
|
|
33
33
|
try:
|
|
34
|
-
self.check_perm(public, func.__name__, *args, **kwargs)
|
|
34
|
+
self.check_perm(public, func.__name__, perms, *args, **kwargs)
|
|
35
35
|
return func(self, *args, **kwargs)
|
|
36
36
|
except APIError as e:
|
|
37
37
|
return e.response
|
|
@@ -1325,7 +1325,7 @@ class SecuredRestViewMixin(View):
|
|
|
1325
1325
|
return getattr(self, param)
|
|
1326
1326
|
return self.default_public if public is None else public
|
|
1327
1327
|
|
|
1328
|
-
def check_perm(self, public, func_name, *args, **kwargs):
|
|
1328
|
+
def check_perm(self, public, func_name, perms, *args, **kwargs):
|
|
1329
1329
|
"""Check permissions for a specific service.
|
|
1330
1330
|
|
|
1331
1331
|
Do all checks for a specific service and raise
|
|
@@ -1338,6 +1338,12 @@ class SecuredRestViewMixin(View):
|
|
|
1338
1338
|
return
|
|
1339
1339
|
if not self.request.user.is_authenticated:
|
|
1340
1340
|
raise UnauthorizedError()
|
|
1341
|
+
if isinstance(perms, str):
|
|
1342
|
+
if not self.request.user.has_perm(perms):
|
|
1343
|
+
raise ForbiddenError()
|
|
1344
|
+
elif perms:
|
|
1345
|
+
if not self.request.user.has_perms(perms):
|
|
1346
|
+
raise ForbiddenError()
|
|
1341
1347
|
if not self.perm():
|
|
1342
1348
|
raise ForbiddenError()
|
|
1343
1349
|
fperm = f'{func_name}_perm'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 4.2.17 on 2025-01-22 03:31
|
|
2
|
+
# flake8: noqa
|
|
3
|
+
|
|
4
|
+
from django.db import migrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
('tests', '0001_initial'),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
migrations.AlterModelOptions(
|
|
15
|
+
name='author',
|
|
16
|
+
options={'ordering': ['last_name', 'first_name', 'pk'], 'permissions': [('can_customize_author', 'Can customize author')], 'verbose_name': 'Author', 'verbose_name_plural': 'Authors'},
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -89,6 +89,7 @@ class Author(CacheableMixin, JSONReprMixin, models.Model):
|
|
|
89
89
|
verbose_name = "Author"
|
|
90
90
|
verbose_name_plural = "Authors"
|
|
91
91
|
ordering = ['last_name', 'first_name', 'pk']
|
|
92
|
+
permissions = [("can_customize_author", "Can customize author")]
|
|
92
93
|
|
|
93
94
|
def __str__(self):
|
|
94
95
|
return f"{self.first_name} {self.last_name}"
|
|
@@ -237,3 +237,49 @@ class TestPermissions(TestAssertMixin, TestCase):
|
|
|
237
237
|
response = self.client.get(
|
|
238
238
|
f'/api/perms/books/{self.author1_book1.pk}/cover')
|
|
239
239
|
self.assertRC(response, 200)
|
|
240
|
+
|
|
241
|
+
def test_custom_get_admin(self):
|
|
242
|
+
self.client.login(username='admin')
|
|
243
|
+
|
|
244
|
+
response = self.client.get('/api/perms/authors/custom')
|
|
245
|
+
self.assertRC(response, 200)
|
|
246
|
+
|
|
247
|
+
def test_custom_get_user(self):
|
|
248
|
+
self.client.login(username='user')
|
|
249
|
+
|
|
250
|
+
response = self.client.get('/api/perms/authors/custom')
|
|
251
|
+
self.assertRC(response, 403)
|
|
252
|
+
|
|
253
|
+
self.user.user_permissions.add(*permissions('tests.view_author'))
|
|
254
|
+
|
|
255
|
+
response = self.client.get('/api/perms/authors/custom')
|
|
256
|
+
self.assertRC(response, 200)
|
|
257
|
+
|
|
258
|
+
def test_custom_put_admin(self):
|
|
259
|
+
self.client.login(username='admin')
|
|
260
|
+
|
|
261
|
+
response = self.client.put('/api/perms/authors/custom')
|
|
262
|
+
self.assertRC(response, 200)
|
|
263
|
+
|
|
264
|
+
def test_custom_put_user(self):
|
|
265
|
+
self.client.login(username='user')
|
|
266
|
+
|
|
267
|
+
response = self.client.put('/api/perms/authors/custom')
|
|
268
|
+
self.assertRC(response, 403)
|
|
269
|
+
|
|
270
|
+
self.user.user_permissions.set(permissions('tests.change_author'))
|
|
271
|
+
|
|
272
|
+
response = self.client.put('/api/perms/authors/custom')
|
|
273
|
+
self.assertRC(response, 403)
|
|
274
|
+
|
|
275
|
+
self.user.user_permissions.set(permissions(
|
|
276
|
+
'tests.can_customize_author'))
|
|
277
|
+
|
|
278
|
+
response = self.client.put('/api/perms/authors/custom')
|
|
279
|
+
self.assertRC(response, 403)
|
|
280
|
+
|
|
281
|
+
self.user.user_permissions.set(permissions(
|
|
282
|
+
'tests.change_author', 'tests.can_customize_author'))
|
|
283
|
+
|
|
284
|
+
response = self.client.put('/api/perms/authors/custom')
|
|
285
|
+
self.assertRC(response, 200)
|
|
@@ -191,7 +191,15 @@ class PrivateAuthorRestView(AuthorRestViewMixin, RestView):
|
|
|
191
191
|
@rest_view("/perms/authors")
|
|
192
192
|
class PermsAuthorRestView(
|
|
193
193
|
AuthorRestViewMixin, SlugPermsDetailRestViewMixin, PermsRestView):
|
|
194
|
-
|
|
194
|
+
|
|
195
|
+
@rest_api("/custom", method="get", perms='tests.view_author')
|
|
196
|
+
def get_custom(self):
|
|
197
|
+
return JsonResponse(dict(message='Custom get'))
|
|
198
|
+
|
|
199
|
+
@rest_api("/custom", method="put", perms=[
|
|
200
|
+
'tests.change_author', 'tests.can_customize_author'])
|
|
201
|
+
def get_custom_action(self):
|
|
202
|
+
return JsonResponse(dict(message='Custom put'))
|
|
195
203
|
|
|
196
204
|
|
|
197
205
|
@rest_view("/admin-edit/authors")
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/migrations/0002_pfxpermissionsuser.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
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/models/user_filtered_queryset_mixin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/otp_code_email.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/welcome_email.txt
RENAMED
|
File without changes
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/templates/registration/welcome_subject.txt
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/media_redirect.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
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/subset_page_size.py
RENAMED
|
File without changes
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/pfx/pfxcore/views/parameters/subset_page_subset.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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_base_user/settings/dev_custom_example.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_pfx-1.4.dev70 → django_pfx-1.4.dev72}/tests_custom_user/settings/dev_custom_example.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|