示例#1
0
def update_name(request,permissionid):
    result=True
    try:
        PermissionService.update_permission_name(request, permissionid)
    except Exception as ex:
        SimpleLogger.exception(ex)
        result=str(ex)
    return HttpResponse(result)
示例#2
0
def permission_delete(request):
    result=True
    try:
        PermissionService.delete_permission(request)
    except Exception as ex:
        print(ex)
        SimpleLogger.exception(ex)
        result=str(ex)
    return HttpResponse(result)
示例#3
0
 def get_role_permission_edit_webpart(self,roleid):
     role=SystemRoleService.get_role(roleid)
     temp_role=VM_SystemRole(role)
     all_custom_permissions=PermissionService.all_custom_permissions()
     permission_list_webpart=self.get_role_permission_controll(all_custom_permissions,roleid)
     pagefileds={"role":temp_role,'permission_list_webpart':permission_list_webpart}
     return self.get_webpart(pagefileds,AdminSystemRolePath.admin_system_role_edit_page)
示例#4
0
 def get_permission_sub_navbar(self, request, sub_nav_action):
     permissions_count = len(PermissionService.all_custom_permissions())
     return self.get_sub_nav_bar(
         request,
         self.subpage_model,
         AdminPermissionPath.admin_permission_subnav,
         sub_nav_action=sub_nav_action,
         permissions_count=permissions_count)
示例#5
0
 def is_permission_active(self):
     result = ""
     if self.role_id:
         role = SystemRoleService.get_role(self.role_id)
         permission = PermissionService.get_permission(self.id)
         if permission in role.permissions.all():
             result = "active"
     return result
示例#6
0
 def get_permission_list_webpart(self):
     permissions = PermissionService.all_custom_permissions()
     permission_list_controll = self.get_permission_list_controll(
         permissions)
     pagefileds = {
         "permission_list_controll": permission_list_controll,
         "permissions": permissions
     }
     return self.get_webpart(
         pagefileds, AdminPermissionPath.admin_permission_list_webpart)
示例#7
0
 def update_role_permission(request, roleid):
     role = SystemRoleService.get_role(roleid)
     permission_id = request.POST.get("permission_id")
     active = request.POST.get("active")
     temp_permission = PermissionService.get_permission(permission_id)
     if active == "1":
         role.permissions.add(temp_permission)
     if active == "0":
         role.permissions.remove(temp_permission)
     role.save()
示例#8
0
def role_permission_list(request, roleid):
    all_custom_permissions = PermissionService.all_custom_permissions()
    page_worker = AdminSystemRolePageWorker(request)
    result = page_worker.get_role_permission_controll(all_custom_permissions,
                                                      roleid)
    return HttpResponse(result)
示例#9
0
def permission_list(request):
    page_worker=AdminPermissionPageWorker(request)
    permission_list=page_worker.get_permission_list_controll(PermissionService.all_permissions())
    return HttpResponse(permission_list)
示例#10
0
def check_value_exists(request):
    result=False
    filed_name=request.POST.get("filed","")
    if filed_name=="codename":
        result=PermissionService.check_codename_exists(request)
    return HttpResponse(result)