vistor perm

This commit is contained in:
caoqianming 2020-06-06 21:45:34 +08:00
parent 2e4e801078
commit 71a0533cb6
1 changed files with 11 additions and 1 deletions

View File

@ -16,6 +16,13 @@ ConsumerPerms = [
'exercise'
]
VistorPerms = [
'gen_monitest',
'questioncat_list',
'article_list',
'my_examtest',
]
class MyPermission(RbacPermission):
def has_permission(self, request, view):
@ -32,7 +39,10 @@ class MyPermission(RbacPermission):
# perms = get_permission_list(request.user)
return True
elif isinstance(request.user,Consumer):
perms = ConsumerPerms
if request.user.workscope:
perms = ConsumerPerms
else:
perms = VistorPerms
if perms:
if not hasattr(view, 'perms_map'):
return True