[Improvement-12650][Permission] Improve the check of resourcePermissionCheck() (#12652)
This commit is contained in:
parent
1d0f9a7d04
commit
44e0935f56
|
|
@ -113,10 +113,11 @@ public class ResourcePermissionCheckServiceImpl
|
|||
if (Objects.nonNull(needChecks) && needChecks.length > 0) {
|
||||
Set<?> originResSet = new HashSet<>(Arrays.asList(needChecks));
|
||||
Set<?> ownResSets = RESOURCE_LIST_MAP.get(authorizationType).listAuthorizedResource(userId, logger);
|
||||
originResSet.removeAll(ownResSets);
|
||||
if (CollectionUtils.isNotEmpty(originResSet))
|
||||
boolean checkResult = ownResSets != null && ownResSets.containsAll(originResSet);
|
||||
if (!checkResult) {
|
||||
logger.warn("User does not have resource permission on associated resources, userId:{}", userId);
|
||||
return CollectionUtils.isEmpty(originResSet);
|
||||
}
|
||||
return checkResult;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue