Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,8 @@ public String toString() {

public boolean managesPath(String path, String defaultUnmanagedAcePathsRegex) {
String effectiveUnmanagedAcePathsRegex = StringUtils.defaultIfEmpty(unmanagedAcePathsRegex, defaultUnmanagedAcePathsRegex);
if (StringUtils.isNotBlank(effectiveUnmanagedAcePathsRegex)
&& StringUtils.isNotBlank(path) /* not supporting repository permissions here */) {
boolean pathIsManaged = !path.matches(effectiveUnmanagedAcePathsRegex);
if (StringUtils.isNotBlank(effectiveUnmanagedAcePathsRegex)) {
boolean pathIsManaged = !StringUtils.defaultString(path).matches(effectiveUnmanagedAcePathsRegex);
return pathIsManaged;
} else {
return true; // default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,23 @@ public void testRemoveUnmanagedPrincipalNamesAtPathUsingGlobalConfig() {

}

@Test
public void testRemoveUnmanagedPrincipalNamesAtRepositoryLevel() {
Set<String> principals = principalSet(beanTestGroupAllManaged.getPrincipalName(), testgroupPartlyManaged.getPrincipalName(),
beanEveryone.getPrincipalName());
beanTestGroupAllManaged.setUnmanagedAcePathsRegex("^/etc/.*");
testgroupPartlyManaged.setUnmanagedAcePathsRegex("^$");
beanEveryone.setUnmanagedAcePathsRegex("^/etc/.*");

assertEquals(principalSet("testgroupAllManaged", "everyone"),
authorizablesConfig.removeUnmanagedPrincipalNamesAtPath("", principals, "^$"));

beanTestGroupAllManaged.setUnmanagedAcePathsRegex(null);
testgroupPartlyManaged.setUnmanagedAcePathsRegex(null);
beanEveryone.setUnmanagedAcePathsRegex(null);
assertEquals(Collections.emptySet(), authorizablesConfig.removeUnmanagedPrincipalNamesAtPath("", principals, "^$"));
}

private AuthorizableConfigBean getBean(String name, String unmanagedAcePathRegex) {
AuthorizableConfigBean beanEveryone = new AuthorizableConfigBean();
beanEveryone.setPrincipalName(name);
Expand Down
2 changes: 1 addition & 1 deletion docs/AdvancedFeatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Additionally, it is also possible to set `unmanagedExternalIsMemberOfRegex` and

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

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.
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. Repository-level ACEs are matched against an empty path, so the expression `^$` can be used to exclude them. By setting the global config `defaultUnmanagedAcePathsRegex` it is possible to exclude certain areas of the JCR totally from removing and creating at all, including repository-level ACEs.
Comment thread
kwin marked this conversation as resolved.
Resolved

#### Examples

Expand Down