Skip to main content

Make django router with role permission

Project description

django-role-router is a simply, definition designed router with multi-roles.

You can install it with pip. >pip install django-role-router

To use it, make sure you have installed django-role-router already.

  1. Insert middleware jhvar.django.urls.middleware.JvRoleMiddleware after SessionMiddleware.

  2. You can define app role permission like “permitted_roles = [‘admin’]” in urls.py global section.

  3. You can define path role permission like “jv_path(‘admin’, views.my_admin, name=’my_admin’, roles=[‘admin’])” in urlpatterns list. Path role has more priority than app role.

  4. We have supported regex format with “jv_re_path” function, just like “jv_path”. It can also work with rest_framework router.

  5. You can define logger ‘jhvar.django.logger’ in urls.py logger section, to print debug info.

Now, you have role permission verifier, you should add your role granty in somewhere.

It just like “grant_roles(request, ‘admin’)” or “grant_roles(request, (‘admin’, ‘super’))” or “grant_roles(request, [‘admin’, ‘super’])”.

Join it, have fun!

Visit https://github.com/jhvar/django-utils for more detail.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-role-router-0.2.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_role_router-0.2.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file django-role-router-0.2.1.tar.gz.

File metadata

  • Download URL: django-role-router-0.2.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.0

File hashes

Hashes for django-role-router-0.2.1.tar.gz
Algorithm Hash digest
SHA256 115719b2823627c21b66339627dc283e748bf146c6632f3b31ed1dd3222297fa
MD5 d2d0922e14c6829cd256d425fa1ff719
BLAKE2b-256 f90e6ae3ae3523b574d8e2ab6990776247aa1ecaa9453277b05410699145fbbc

See more details on using hashes here.

File details

Details for the file django_role_router-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: django_role_router-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.0

File hashes

Hashes for django_role_router-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f81a30cf9ea3852da9d41e7b0f0787d14ce63ae7953d6487cb97c25318e8ac01
MD5 d1a8c50bf3524a6ac69913f2f7799aae
BLAKE2b-256 42261f22bcc4aef3959b371159cd90c088bc040d5c661b7f93c436163cea83e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page