{"id":15065823,"url":"https://github.com/nnseva/django-rest-access","last_synced_at":"2026-01-03T00:05:34.292Z","repository":{"id":57421595,"uuid":"257405439","full_name":"nnseva/django-rest-access","owner":"nnseva","description":"Django REST Framework permissions backend based on the django-access package","archived":false,"fork":false,"pushed_at":"2020-04-20T21:57:14.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T14:07:37.854Z","etag":null,"topics":["access","access-control","authority","authorization","authorization-backend","django","django-access","django-rest","django-rest-framework","drf","dynamic","evaluation","evaluation-based","guard","instance-level","permissions","permissions-backend","row-level"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nnseva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-20T21:14:44.000Z","updated_at":"2020-04-22T23:08:18.000Z","dependencies_parsed_at":"2022-09-10T14:10:46.102Z","dependency_job_id":null,"html_url":"https://github.com/nnseva/django-rest-access","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-rest-access","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-rest-access/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-rest-access/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnseva%2Fdjango-rest-access/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nnseva","download_url":"https://codeload.github.com/nnseva/django-rest-access/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809887,"owners_count":20351407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["access","access-control","authority","authorization","authorization-backend","django","django-access","django-rest","django-rest-framework","drf","dynamic","evaluation","evaluation-based","guard","instance-level","permissions","permissions-backend","row-level"],"created_at":"2024-09-25T00:54:41.626Z","updated_at":"2026-01-03T00:05:34.252Z","avatar_url":"https://github.com/nnseva.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/nnseva/django-rest-access.svg)](https://travis-ci.com/nnseva/django-rest-access)\n\n# Django-REST-Access\n\nThe Django-REST-Access package provides a permissions backend for the [Django REST Framework](https://www.django-rest-framework.org)\nusing access rules defined by the [Django-Access](https://github.com/nnseva/django-access) package.\n\n## Installation\n\n*Stable version* from the PyPi package repository\n```bash\npip install django-rest-access\n```\n\n*Last development version* from the GitHub source version control system\n```bash\npip install git+git://github.com/nnseva/django-rest-access.git\n```\n\n## Configuration\n\nInclude the `rest_framework`, `access`, and `rest_access` applications into the `INSTALLED_APPS` list, like:\n\n```python\nINSTALLED_APPS = [\n    'django.contrib.admin',\n    'django.contrib.auth',\n    ...\n    'rest_framework',\n    'access',\n    'rest_access',\n    ...\n]\n```\n\n## Using\n\n### Define access rules\n\nDefine access rules as it is described in the [Django-Access](https://github.com/nnseva/django-access) package documentation.\n\n### Serializer Mixin\n\nUse `rest_access.access.AccessSerializerMixin` as a first of base classes for every Serializer in your API description which\nshould be controlled by access rules defined using [Django-Access](https://github.com/nnseva/django-access) package, like:\n\n```python\nfrom rest_framework import serializers, viewsets\nfrom rest_access.access import AccessSerializerMixin\nfrom django.contrib.auth.models import User, Group\n\n...\n\nclass GroupSerializer(AccessSerializerMixin, serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = Group\n        fields = ('url', 'id', 'name')\n```\n\n### Authorization backend to use\n\nThe authorization backend `rest_access.access.AccessPermission` should be used as the both,\npermission control backend and filtering class.\n\nThe `rest_access.access.AccessPermission` can be used together with other\npermission control backends and filtering classes without restrictions.\n\n#### Using authorization backend individually for selected model views\n\nYou can assign a permissions control backend and filtering class for the sole, or some subset of model views\nor viewsets like it is described in the\n[Django REST Framework permission documentation](https://www.django-rest-framework.org/api-guide/permissions/)\nand [Django REST Framework filtering documentation](https://www.django-rest-framework.org/api-guide/filtering/)\ncorrespondingly:\n\n```python\nfrom rest_framework import serializers, viewsets\n...\n\nclass SomeModelViewSet(viewsets.ModelViewSet):\n    ...\n    permission_classes = ['rest_access.access.AccessPermission']\n    filter_backends = ['rest_access.access.AccessPermission']\n```\n\n#### Using authorization backend as a default one\n\nYou can assign a permission control backend and filtering class as default ones for all views in the project using settings module\nas it is described in the [Django REST Framework settings documentation](https://www.django-rest-framework.org/api-guide/settings/):\n\n```python\nREST_FRAMEWORK = {\n    'DEFAULT_PERMISSION_CLASSES': [\n        'rest_access.access.AccessPermission'\n    ],\n    'DEFAULT_FILTER_BACKENDS': [\n        'rest_access.access.AccessPermission'\n    ],\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnseva%2Fdjango-rest-access","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnnseva%2Fdjango-rest-access","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnseva%2Fdjango-rest-access/lists"}