Commit ba859c9d authored by lgcareer's avatar lgcareer Committed by qiaozhanwei
Browse files

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
parent 9a13d97d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1774,10 +1774,10 @@ public class ProcessDao {
    public List<String> listUnauthorizedResource(int userId,String[] resNames){
        List<String> resultList = new ArrayList<String>();

        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());
        }
+1 −1
Original line number Diff line number Diff line
@@ -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());