Esempio n. 1
0
 def GetDTByOrganize(userInfo, organizeId, showUser=True):
     """
     按组织机构获取角色列表
     Args:
         organizeId (string) : 组织机构主键
         showUser (bool) : 显示用户
     Returns:
         returnValue (Pirole[]): 角色列表
     """
     LogService.WriteLog(userInfo, __class__.__name__,
                         FrameworkMessage.RoleService,
                         sys._getframe().f_code.co_name,
                         FrameworkMessage.RoleService_GetDTByOrganize,
                         organizeId)
     dtRole = Pirole.objects.filter(
         Q(organizeid=organizeId) & Q(deletemark=0)).order_by('sortcode')
     if showUser:
         username = ''
         dataTableUser = UserSerivce.GetDT(None)
         for role in dtRole:
             userIds = UserSerivce.GetUserIdsInRole(None, role.id)
             if userIds:
                 for userid in userIds:
                     username = username + Piuser.objects.get(
                         id=userid).realname + ', '
             if username:
                 role.users = username[:-2]
             username = ""
     return dtRole
Esempio n. 2
0
def GetUserListJson(request):
    response = HttpResponse()
    user = CommonUtils.Current(response, request)
    if user.IsAdministrator or (not "Resource.ManagePermission") or (SystemInfo.EnableUserAuthorizationScope):
        dtUser = UserSerivce.GetDT(user)
    else:
        dtUser = ScopPermission.GetUserDTByPermissionScope(None, user.Id, "Resource.ManagePermission")

    userTmp = ''
    for user in dtUser:
        userTmp = userTmp + ', ' + user.toJSON()
    userTmp = userTmp.strip(',')
    returnValue = '[' + userTmp + ']'
    response.content = returnValue
    return response
Esempio n. 3
0
 def GetDTByDepartment(self, departmentId, containChildren):
     """
     按部门获取用户列表
     Args:
         departmentId (string): 部门主键
         containChildren (string): 含有子部门
     Returns:
         returnValue (Piuser or None): 用户实体
     """
     if not departmentId:
         #dataTable = Piuser.objects.filter(deletemark=0).order_by('sortcode', flat=True)
         dataTable = UserSerivce.GetDT(None)
     else:
         dataTable = UserSerivce.GetDepartmentUsers(self, departmentId,
                                                    containChildren)
     return dataTable