Browse Source

修改如果用户没有创建资源时给用户授权资源会报空指针

pull/2/head
lilin 6 years ago
parent
commit
00ba3cd628
  1. 12
      escheduler-api/src/main/java/cn/escheduler/api/service/ResourcesService.java

12
escheduler-api/src/main/java/cn/escheduler/api/service/ResourcesService.java

@ -701,17 +701,19 @@ public class ResourcesService extends BaseService {
if (checkAdmin(loginUser, result)) {
return result;
}
List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId);
Set<Resource> resourceSet = null;
List<Object> list ;
if (resourceList != null && resourceList.size() > 0) {
resourceSet = new HashSet<>(resourceList);
Set<Resource> resourceSet = new HashSet<>(resourceList);
List<Resource> authedResourceList = resourcesMapper.queryAuthorizedResourceList(userId);
getAuthorizedResourceList(resourceSet, authedResourceList);
list = new ArrayList<>(resourceSet);
}else {
list = new ArrayList<>(0);
}
result.put(Constants.DATA_LIST, new ArrayList<>(resourceSet));
result.put(Constants.DATA_LIST, list);
putMsg(result,Status.SUCCESS);
return result;
}

Loading…
Cancel
Save