semvec/pypi-packages huggingface dataset:
django-role-router 0.2.1
Make django router with role permission
License: MIT Licence
Requires Python: >=3.6
Keywords: pip,django,role,util

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.