Perm feature See merge request !48remotes/origin/pm_task_31703
commit
ee70816d34
2 changed files with 17 additions and 0 deletions
@ -0,0 +1,16 @@ |
|||||||
|
from django.http import HttpResponseForbidden |
||||||
|
|
||||||
|
|
||||||
|
class CheckPerm(object): |
||||||
|
@staticmethod |
||||||
|
def process_request(request): |
||||||
|
if '/admin' in request.path or "/management" in request.path \ |
||||||
|
or '/analytics' in request.path: |
||||||
|
|
||||||
|
if not request.user.is_authenticated(): |
||||||
|
return HttpResponseForbidden() |
||||||
|
|
||||||
|
if not (request.user.in_role == "M" or request.user.in_role == "S" |
||||||
|
or request.user.in_role == "A" or request.user.is_admin): |
||||||
|
|
||||||
|
return HttpResponseForbidden() |
||||||
Loading…
Reference in new issue