Skip to content

Commit 3454b9b

Browse files
Copilotkwin
andauthored
Skip creating ACEs on paths matching an authorizable's unmanagedAcePathsRegex (#924)
Log skipped unmanaged ACEs as warning This closes #925 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kwin <185025+kwin@users.noreply.github.com>
1 parent 40cd796 commit 3454b9b

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/BaseAceBeanInstaller.java‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,15 @@ public void installPathBasedACEs(
8686
// order entries (denies in front of allows)
8787
final Set<AceBean> orderedAceBeanSetFromConfig = new TreeSet<AceBean>(
8888
new AcePermissionComparator());
89-
orderedAceBeanSetFromConfig.addAll(aceBeanSetFromConfig);
89+
for (AceBean aceBean : aceBeanSetFromConfig) {
90+
if (acConfiguration.getAuthorizablesConfig().managesPathForPrincipal(path, aceBean.getPrincipalName(),
91+
acConfiguration.getGlobalConfiguration().getDefaultUnmanagedAcePathsRegex())) {
92+
orderedAceBeanSetFromConfig.add(aceBean);
93+
} else {
94+
history.addWarning(LOG, "Skipped ACE for path " + path + " and principal " + aceBean.getPrincipalName()
95+
+ " as the path matches unmanagedAcePathsRegex");
96+
}
97+
}
9098

9199
Set<String> principalsToRemoveAcesForAtThisPath = acConfiguration.getAuthorizablesConfig()
92100
.removeUnmanagedPrincipalNamesAtPath(path, principalsToRemoveAcesFor,

‎accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/configmodel/AuthorizablesConfig.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@ public Set<String> removeUnmanagedPrincipalNamesAtPath(String path, Set<String>
8686
return filteredPrincipals;
8787
}
8888

89+
public boolean managesPathForPrincipal(String path, String principal, String defaultUnmanagedAcePathsRegex) {
90+
AuthorizableConfigBean authorizableConfig = configBeansByPrincipalId.get(principal);
91+
return authorizableConfig == null || authorizableConfig.managesPath(path, defaultUnmanagedAcePathsRegex);
92+
}
93+
8994
}

‎docs/AdvancedFeatures.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Additionally, it is also possible to set `unmanagedExternalIsMemberOfRegex` and
355355

356356
### Limiting where the AC Tool creates and removes ACEs
357357

358-
The property `unmanagedAcePathsRegex` for authorizable configurations (users or groups) can be used to ensure certain paths are not managed by the AC Tool. This property must contain a regular expression which is matched against all ACE paths bound to the authorizable found in the system. All ACEs with matching paths are not touched. By setting the global config `defaultUnmanagedAcePathsRegex` it is possible to exclude certain areas of the JCR totally from removing (and creating once #244 is fixed) at all.
358+
The property `unmanagedAcePathsRegex` for authorizable configurations (users or groups) can be used to ensure certain paths are not managed by the AC Tool. This property must contain a regular expression which is matched against all ACE paths bound to the authorizable found in the system. All ACEs with matching paths are not touched. By setting the global config `defaultUnmanagedAcePathsRegex` it is possible to exclude certain areas of the JCR totally from removing and creating at all.
359359

360360
#### Examples
361361

0 commit comments

Comments
 (0)