perms
This commit is contained in:
parent
ee437a7889
commit
6f2510288c
|
@ -1,5 +1,4 @@
|
|||
from rbac.permission import RbacPermission
|
||||
from rbac.permission import get_permission_list
|
||||
from rbac.models import UserProfile
|
||||
from crm.models import Consumer
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
|
@ -28,13 +27,12 @@ class MyPermission(RbacPermission):
|
|||
if 'perms' in request.session:
|
||||
perms = request.session['perms']
|
||||
elif isinstance(request.user,UserProfile): # 如果是管理员表
|
||||
perms = get_permission_list(request.user)
|
||||
# perms = get_permission_list(request.user)
|
||||
return True
|
||||
elif isinstance(request.user,Consumer):
|
||||
perms = ConsumerPerms
|
||||
if perms:
|
||||
if 'admin' in perms:
|
||||
return True
|
||||
elif not hasattr(view, 'perms_map'):
|
||||
if not hasattr(view, 'perms_map'):
|
||||
return True
|
||||
else:
|
||||
perms_map = view.perms_map
|
||||
|
|
Loading…
Reference in New Issue