提交 ba859c9d 编写于 作者: L lgcareer 提交者: qiaozhanwei

update method checkDownloadPermission in order to fix issues 1770 (#1794)

* add check download resource permission in order to fix issues 1770

* update method checkDownloadPermission in order to fix issues 1770

* update method listUnauthorizedResource in order to fix issues 1770
上级 9a13d97d
......@@ -1774,10 +1774,10 @@ public class ProcessDao {
public List<String> listUnauthorizedResource(int userId,String[] resNames){
List<String> resultList = new ArrayList<String>();
List<String> originResList = Arrays.asList(resNames);
List<Resource> authorizedResourceList = resourceMapper.listAuthorizedResource(userId, resNames);
if(ArrayUtils.isNotEmpty(resNames)){
List<String> originResList = Arrays.asList(resNames);
List<Resource> authorizedResourceList = resourceMapper.listAuthorizedResource(userId, resNames);
if(CollectionUtils.isNotEmpty(authorizedResourceList)){
List<String> authorizedResNames = authorizedResourceList.stream().map(t -> t.getAlias()).collect(toList());
resultList = originResList.stream().filter(item -> !authorizedResNames.contains(item)).collect(toList());
}
......
......@@ -342,7 +342,7 @@ public class TaskScheduleThread implements Runnable {
// get user type in order to judge whether the user is admin
User user = processDao.getUserById(userId);
if (user.getUserType() != UserType.ADMIN_USER){
List<String> unauthorizedResource = processDao.listUnauthorizedResource(userId, (String[]) projectRes.toArray());
List<String> unauthorizedResource = processDao.listUnauthorizedResource(userId, projectRes.toArray(new String[projectRes.size()]));
// if exist unauthorized resource
if(CollectionUtils.isNotEmpty(unauthorizedResource)){
logger.error("user {} didn't has download permission of resource file: {}", user.getUserName(), unauthorizedResource.toString());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册