def role_create(request): result = True try: SystemRoleService.create_role(request) except Exception as ex: SimpleLogger.exception(ex) result = str(ex) return HttpResponse(result)
def update_description(request, roleid): result = True try: SystemRoleService.update_role_description(request, roleid) except Exception as ex: SimpleLogger.exception(ex) result = str(ex) return HttpResponse(result)
def role_delete(request, roleid): result = True try: SystemRoleService.delete_role(request, roleid) except Exception as ex: print(ex) SimpleLogger.exception(ex) result = str(ex) return HttpResponse(result)
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)
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
def get_system_role_sub_navbar(self, request, sub_nav_action): system_role_count = len(SystemRoleService.all_roles()) return self.get_sub_nav_bar( request, self.subpage_model, AdminSystemRolePath.admin_system_role_subnav, sub_nav_action=sub_nav_action, system_role_counts=system_role_count)
def get_system_role_list_webpart(self): roles = SystemRoleService.all_roles() system_role_list_controll = self.get_system_role_list_controll(roles) pagefileds = { "system_role_list_controll": system_role_list_controll, "roles": roles } return self.get_webpart( pagefileds, AdminSystemRolePath.admin_system_role_list_webpart)
def is_authed(self,context,auth_group): result=False request=context['request'] current_group=SystemRoleService.get_role(auth_group) for group in request.user.groups.all(): if group.extend_info.group_priority<=current_group.extend_info.group_priority: result=True break return result
def is_authed(request, auth_group): result = False if not request.user.is_authenticated: return result current_group = SystemRoleService.get_role(auth_group) for group in request.user.groups.all(): if group.extend_info.group_priority <= current_group.extend_info.group_priority: result = True break return result
def userrole_list(request): page_worker = AdminSystemRolePageWorker(request) user_list = page_worker.get_system_role_list_controll( SystemRoleService.all_roles()) return HttpResponse(user_list)
def check_value_exists(request): result = False filed_name = request.POST.get("filed", "") if filed_name == "group_name": result = SystemRoleService.check_rolename_exists(request) return HttpResponse(result)