From f4257702114756be63f5a914247ec6b764979c3d Mon Sep 17 00:00:00 2001 From: evasques Date: Tue, 9 Jun 2020 17:17:49 +0100 Subject: [PATCH] Merge release/V2.7.0.x into release/V2.7 (#1146) * Update copyright header for 2020. * MNT-21585 - Having EVERYONE in original ACL causes IPR duplication (#1144) * MNT-21585 - Having EVERYONE in original authorities causes IPR duplication * Update License Headers * prevent NPE when authorities is null and refactored findIPRGroup method * RM-7131 Update old gitlab repo links with the new one from github (cherry picked from commit c3cdd88873997e9b6cfbbc3bc5880a70f729597d) * Change SCM URLs in order to switch to SSH authentication with 2FA for Github (cherry picked from commit 53f26b5793a6edf4eecaddad3b558aa8653ee747) * [maven-release-plugin] prepare release V2.7.0.2 * [maven-release-plugin] prepare for next development iteration Co-authored-by: Tom Page Co-authored-by: Claudia Agache Co-authored-by: alfresco-build --- .../security/ExtendedSecurityServiceImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java index 2f1fe9e7c5..8d62385d9e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java @@ -407,13 +407,12 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl // if exists and matches we have found our group if (isIPRGroupTrueMatch(group, authorities)) { - iprGroup = group; - break; + return new Pair(group, nextGroupIndex); } } // determine if there are any more pages to inspect - hasMoreItems = results.hasMoreItems(); + hasMoreItems = hasMoreItems ? results.hasMoreItems() : false; pageCount ++; } @@ -429,8 +428,15 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl */ private boolean isIPRGroupTrueMatch(String group, Set authorities) { + //Remove GROUP_EVERYONE for proper comparison as GROUP_EVERYONE is never included in an IPR group + Set plainAuthorities = new HashSet(); + if (authorities != null) + { + plainAuthorities.addAll(authorities); + plainAuthorities.remove(PermissionService.ALL_AUTHORITIES); + } Set contained = authorityService.getContainedAuthorities(null, group, true); - return contained.equals(authorities); + return contained.equals(plainAuthorities); } /**