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.
Insert middleware jhvar.django.urls.middleware.JvRoleMiddleware after SessionMiddleware.
You can define app role permission like “permitted_roles = [‘admin’]” in urls.py global section.
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.
We have supported regex format with “jv_re_path” function, just like “jv_path”. It can also work with rest_framework router.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_role_router-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f81a30cf9ea3852da9d41e7b0f0787d14ce63ae7953d6487cb97c25318e8ac01 |
|
MD5 | d1a8c50bf3524a6ac69913f2f7799aae |
|
BLAKE2b-256 | 42261f22bcc4aef3959b371159cd90c088bc040d5c661b7f93c436163cea83e2 |