Skip to content

Commit

Permalink
在线用户变更角色筛选项
Browse files Browse the repository at this point in the history
  • Loading branch information
ysc authored and ysc committed Oct 23, 2012
1 parent 9f5a2a5 commit aa4786d
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,18 @@ public static List<User> getUser(Org org,Role role){
//取交集
if(org!=null && role!=null){
//返回特定组织架构及其所有子机构 且 属于特定角色的在线用户
int roleId=role.getId();
List<Integer> orgIds=OrgService.getChildIds(org);
orgIds.add(org.getId());
log.info("特定组织架构及其所有子机构:"+orgIds);
List<Integer> roleIds=RoleService.getChildIds(role);
roleIds.add(role.getId());
log.info("特定组织架构及其所有子组织架构:"+orgIds);
log.info("特定角色及其所有子角色:"+orgIds);
for(Object obj : users){
User user=(User)obj;
log.info("获取到会话ID为:"+sessionRegistry.getAllSessions(obj, false).get(0).getSessionId() +" 的在线用户");
if(orgIds.contains(user.getOrg().getId())){
for(Role r : user.getRoles()){
if(r.getId()==roleId){
if(roleIds.contains(r.getId())){
result.add(user);
break;
}
Expand All @@ -85,7 +87,7 @@ public static List<User> getUser(Org org,Role role){
return result;
}
if(org!=null){
//返回特定组织架构及其所有子机构的在线用户
//返回特定组织架构及其所有子组织架构的在线用户
List<Integer> ids=OrgService.getChildIds(org);
ids.add(org.getId());
log.info("特定组织架构及其所有子机构:"+ids);
Expand All @@ -98,13 +100,14 @@ public static List<User> getUser(Org org,Role role){
}
}
if(role!=null){
//返回属于特定角色的在线用户
int id=role.getId();
//返回属于特定角色及其所有子角色的在线用户
List<Integer> roleIds=RoleService.getChildIds(role);
roleIds.add(role.getId());
for(Object obj : users){
User user=(User)obj;
log.info("获取到会话ID为:"+sessionRegistry.getAllSessions(obj, false).get(0).getSessionId() +" 的在线用户");
for(Role r : user.getRoles()){
if(r.getId()==id){
if(roleIds.contains(r.getId())){
result.add(user);
break;
}
Expand Down

0 comments on commit aa4786d

Please sign in to comment.