Skip to content

Commit 1db7685

Browse files
committed
prepend jcr_root to install hook config file patterns and rename the package property where they are picked
1 parent 46acc26 commit 1db7685

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/installhook/impl/AcToolInstallHookServiceImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
@Component
3232
public class AcToolInstallHookServiceImpl implements AcToolInstallHookService {
3333

34-
public static final String ACL_HOOK_PATHS = "actool.hook.paths.patterns(.*)";
34+
public static final String ACL_HOOK_PATHS = "actool.installhook.configFilesPattern(.*)";
35+
private static final String JCR_ROOT_PREFIX="/jcr_root";
3536
@Reference(policyOption = ReferencePolicyOption.GREEDY)
3637
private AcInstallationServiceInternal acInstallationService;
3738

@@ -48,7 +49,8 @@ public PersistableInstallationLogger installYamlFilesFromPackage(VaultPackage va
4849
Set<Object> propertiesKeys = packageProperties.keySet();
4950
for (Object property : propertiesKeys) {
5051
if (property.toString().matches(ACL_HOOK_PATHS)) {
51-
configPathPatterns.add(packageProperties.getProperty(property.toString()));
52+
configPathPatterns.add(JCR_ROOT_PREFIX + packageProperties.getProperty(property.toString()));
53+
5254
}
5355
}
5456

accesscontroltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/configreader/ConfigFilesRetrieverImplTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,16 @@ public void testIsRelevantConfigurationsFiltered() throws Exception {
9797
Set<String> currentRunmodes = new HashSet<String>(
9898
Arrays.asList("author"));
9999
slingSettings = new ExtendedSlingSettingsServiceImpl(currentRunmodes);
100-
Assert.assertTrue((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/jcr_root/conf", "file.yaml"), "config.author",
100+
Assert.assertTrue((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/conf", "file.yaml"), "config.author",
101101
slingSettings, ImmutableList.<String> of())));
102-
Assert.assertTrue((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/jcr_root/conf", "file.yaml"), "config.author",
103-
slingSettings, ImmutableList.<String> of("/noMatch", "/jcr_root/conf/.*"))));
104-
Assert.assertFalse((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/jcr_root/conf", "file.yaml"), "config.author",
105-
slingSettings, ImmutableList.<String> of("/jcr_root/conf/test.*.yaml"))));
106-
Assert.assertTrue((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/jcr_root/conf", "file.yaml"), "config.author",
107-
slingSettings, ImmutableList.<String> of("/jcr_root/conf/.*\\.yaml", "/noMatch"))));
108-
Assert.assertFalse((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/jcr_root/conf", "file.yaml"), "config.author",
109-
slingSettings, ImmutableList.<String> of("/jcr_root/nonconf.*"))));
102+
Assert.assertTrue((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/conf", "file.yaml"), "config.author",
103+
slingSettings, ImmutableList.<String> of("/noMatch", "/conf/.*"))));
104+
Assert.assertFalse((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/conf", "file.yaml"), "config.author",
105+
slingSettings, ImmutableList.<String> of("/conf/test.*.yaml"))));
106+
Assert.assertTrue((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/conf", "file.yaml"), "config.author",
107+
slingSettings, ImmutableList.<String> of("/conf/.*\\.yaml", "/noMatch"))));
108+
Assert.assertFalse((ConfigFilesRetrieverImpl.isRelevantConfiguration(new StubEntry("/conf", "file.yaml"), "config.author",
109+
slingSettings, ImmutableList.<String> of("/nonconf.*"))));
110110

111111
}
112112

docs/ApplyConfig.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ If you would rather use the filevault-package-maven-plugin for building the pack
7171

7272
The `*.yaml` files are installed directly from the package content and respect the [run mode semantics](Configuration.md). Otherwise there is no limitation, so the YAML files will be picked up from anywhere in the package (as long as the parent node does not contain a `.` followed by one or multiple not matching run modes).
7373

74-
If you wish to limit which YAML files are picked up by the installation hook, you can add one or more regular expressions as package properties that start with the prefix `actool.hook.paths.patterns`. If the path of a file within the package matches any of the provided patterns, it will be picked up by the installation hook:
74+
If you wish to limit which YAML files are picked up by the installation hook, you can add one or more regular expressions as package properties that start with the prefix `actool.installhook.configFilesPattern`. If the path of a file matches any of the provided patterns, it will be picked up by the installation hook:
7575

7676
```
7777
<plugin>
@@ -80,8 +80,8 @@ If you wish to limit which YAML files are picked up by the installation hook, yo
8080
<configuration>
8181
<properties>
8282
<installhook.actool.class>biz.netcentric.cq.tools.actool.installhook.AcToolInstallHook</installhook.actool.class>
83-
<actool.hook.paths.patterns.groups>/jcr_content/apps/myapp/acl/groups.*</actool.hook.paths.patterns.groups>
84-
<actool.hook.paths.patterns.users>/jcr_content/apps/myapp/acl/users.*</actool.hook.paths.patterns.users>
83+
<actool.installhook.configFilesPattern.groups>/apps/myapp/acl/groups.*</actool.installhook.configFilesPattern.groups>
84+
<actool.installhook.configFilesPattern.users>/apps/myapp/acl/users.*</actool.installhook.configFilesPattern.users>
8585
</properties>
8686
</configuration>
8787
</plugin>

0 commit comments

Comments
 (0)