Skip to content

Commit c9f1b7a

Browse files
committed
Merge branch 'release/1.8.0'
2 parents 2a82cb8 + 7d37dd3 commit c9f1b7a

File tree

23 files changed

+1168
-349
lines changed

23 files changed

+1168
-349
lines changed

HISTORY

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The Access Control Tool for Adobe Experience Manager (ACTool) is a tool that sim
77

88
Building the ACTool requires Java 7 and Maven 3.2.
99

10-
Installing ACTool requires CQ5.6/AEM 6.0/AEM 6.1.
10+
Installing ACTool requires CQ5.6.1 (min. SP2)/AEM 6.0/AEM 6.1.
1111

1212
# Installation
1313

@@ -25,6 +25,15 @@ The package can be installed using the AEM Package Manager or directly from the
2525
mvn -PautoInstallPackage install
2626
```
2727

28+
## AEM6.x/Oak
29+
30+
The `oakindex-package` contains an optimized Oak index to cover all queries being issued by the Access Control Tool. To build (and optionally deploy) the content-package use the Maven profile oakindex. This package is only compatible with Oak and even there it is optional (as it will only speed up queries).
31+
32+
To use the package, run all commands with profile `oakindex`, e.g.
33+
```
34+
mvn clean install -Poakindex
35+
```
36+
2837
# Configuration File Format
2938

3039
For better human readability and easy editing the ACL configuration files use the YAML format.
@@ -108,7 +117,7 @@ Overall format
108117
actions: actions string
109118
privileges: privileges string
110119
repGlob: regex (optional, path restriction as regular expression)
111-
initialContent: <jcr:root jcr:primaryType="sling:Folder"> (optional)
120+
initialContent: <jcr:root jcr:primaryType="sling:Folder"/> (optional)
112121
```
113122

114123
Only ACEs for groups which are defined in the same configuration file can be installed! This ensures a consistency between the groups and their ACE definitions per configuration file.
@@ -233,6 +242,54 @@ This will create 12 groups:
233242
* content-BRAND2-MKT2-reader
234243
* content-BRAND2-MKT2-writer
235244

245+
### Loops derived from content structure (since 1.8.x)
246+
247+
For some use cases it is useful to dynamically derive the list of possible values from the content structure. FOR ... IN CHILDREN OF will loop over the children of the provided path (skipping 'jcr:content' nodes) and provide an object with the properties name, path, primaryType, jcr:content (a map of all properties of the respective node) and title (./jcr:content/jcr:title added to root map for convenience).
248+
249+
```
250+
- FOR site IN CHILDREN OF /content/myPrj:
251+
252+
- content-reader-${site.name}:
253+
- name: Content Reader ${site.title}
254+
isMemberOf:
255+
path: /home/groups/${site.name}
256+
```
257+
258+
259+
### Conditional entries (since 1.8.x)
260+
261+
When looping over content structures, entries can be applied conditionally using the "IF" keyword:
262+
263+
```
264+
- FOR site IN CHILDREN OF /content/myPrj:
265+
266+
- content-reader-${site.name}:
267+
- name: Content Reader ${site.title}
268+
isMemberOf:
269+
path: /home/groups/${site.name}
270+
271+
IF ${endsWith(site.name,'-master')}:
272+
- content-reader-master-${site.name}:
273+
- name: Master Content Reader ${site.title}
274+
isMemberOf:
275+
path: /home/groups/global
276+
```
277+
278+
Expressions are evaluated using javax.el expression language. The following utility functions are made available to any EL expression used in yaml:
279+
280+
- split(str,separator)
281+
- join(array,separator)
282+
- subarray(array,startIndexInclusive,endIndexExclusive)
283+
- upperCase(str)
284+
- lowerCase(str)
285+
- substringAfter(str,separator)
286+
- substringBefore(str,separator)
287+
- substringAfterLast(str,separator)
288+
- substringBeforeLast(str,separator)
289+
- contains(str,fragmentStr)
290+
- endsWith(str,fragmentStr)
291+
- startsWith(str,fragmentStr)
292+
236293
## Validation
237294

238295
First the validation of the different configuration lines is performed based on regular expressions and gets applied while reading the file. Further validation consists of checking paths for existence as well as for double entries, checks for conflicting ACEs (e.g. allow and deny for same actions on same node), checks whether principals are existing under home. If an invalid parameter or aforementioned issue gets detected, the reading gets aborted and an appropriate error message gets append in the installation history and log.

accesscontroltool-bundle/pom.xml

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>biz.netcentric.cq.tools.accesscontroltool</groupId>
1313
<artifactId>accesscontroltool</artifactId>
14-
<version>1.7.0</version>
14+
<version>1.8.0</version>
1515
</parent>
1616

1717
<!-- ====================================================================== -->
@@ -23,10 +23,6 @@
2323
<name>Access Control Tool Bundle</name>
2424

2525
<dependencies>
26-
<dependency>
27-
<groupId>com.adobe.aem</groupId>
28-
<artifactId>aem-api</artifactId>
29-
</dependency>
3026
<dependency>
3127
<groupId>org.osgi</groupId>
3228
<artifactId>org.osgi.compendium</artifactId>
@@ -121,13 +117,62 @@
121117
<artifactId>hamcrest-library</artifactId>
122118
<version>1.3</version>
123119
</dependency>
120+
<dependency>
121+
<groupId>org.apache.jackrabbit</groupId>
122+
<artifactId>jackrabbit-jcr-commons</artifactId>
123+
</dependency>
124+
<dependency>
125+
<groupId>org.apache.sling</groupId>
126+
<artifactId>org.apache.sling.settings</artifactId>
127+
</dependency>
128+
<dependency>
129+
<groupId>com.day.jcr.vault</groupId>
130+
<artifactId>com.day.jcr.vault</artifactId>
131+
</dependency>
132+
133+
134+
<dependency>
135+
<groupId>org.apache.tomcat</groupId>
136+
<artifactId>el-api</artifactId>
137+
<version>6.0.41</version>
138+
</dependency>
139+
<dependency>
140+
<groupId>org.apache.tomcat</groupId>
141+
<artifactId>jasper-el</artifactId>
142+
<version>6.0.41</version>
143+
</dependency>
144+
145+
<dependency>
146+
<groupId>org.slf4j</groupId>
147+
<artifactId>slf4j-log4j12</artifactId>
148+
<version>1.7.6</version>
149+
<scope>test</scope>
150+
</dependency>
151+
152+
<dependency>
153+
<groupId>org.apache.jackrabbit</groupId>
154+
<artifactId>oak-core</artifactId>
155+
<version>1.3.9</version>
156+
<scope>test</scope>
157+
</dependency>
124158
</dependencies>
125159

126160
<!-- ====================================================================== -->
127161
<!-- B U I L D D E F I N I T I O N -->
128162
<!-- ====================================================================== -->
129163
<build>
130164
<plugins>
165+
166+
<plugin>
167+
<groupId>org.apache.felix</groupId>
168+
<artifactId>maven-bundle-plugin</artifactId>
169+
<configuration>
170+
<instructions>
171+
<Embed-Dependency>el-api,jasper-el</Embed-Dependency>
172+
</instructions>
173+
174+
</configuration>
175+
</plugin>
131176
<plugin>
132177
<groupId>org.apache.felix</groupId>
133178
<artifactId>maven-scr-plugin</artifactId>

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceservice/impl/AceServiceImpl.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import biz.netcentric.cq.tools.actool.configreader.ConfigFilesRetriever;
5050
import biz.netcentric.cq.tools.actool.configreader.ConfigReader;
5151
import biz.netcentric.cq.tools.actool.configreader.ConfigurationMerger;
52-
import biz.netcentric.cq.tools.actool.configreader.YamlConfigurationMerger;
5352
import biz.netcentric.cq.tools.actool.dumpservice.Dumpservice;
5453
import biz.netcentric.cq.tools.actool.helper.AcHelper;
5554
import biz.netcentric.cq.tools.actool.helper.AccessControlUtils;
@@ -82,6 +81,9 @@ public class AceServiceImpl implements AceService {
8281
@Reference
8382
private ConfigReader configReader;
8483

84+
@Reference
85+
private ConfigurationMerger configurationMerger;
86+
8587
@Reference
8688
private ConfigFilesRetriever configFilesRetriever;
8789

@@ -299,7 +301,6 @@ public void installNewConfigurations(Session session,
299301

300302
if (newestConfigurations != null) {
301303

302-
ConfigurationMerger configurationMerger = new YamlConfigurationMerger();
303304
List mergedConfigurations = configurationMerger.getMergedConfigurations(newestConfigurations, history, configReader);
304305

305306
installMergedConfigurations(history, session,
@@ -572,11 +573,9 @@ public Set<String> getAllAuthorizablesFromConfig(Session session)
572573
AcInstallationHistoryPojo history = new AcInstallationHistoryPojo();
573574
Node rootNode = session.getNode(configurationPath);
574575
Map<String, String> newestConfigurations = configFilesRetriever.getConfigFileContentFromNode(rootNode);
575-
ConfigurationMerger configurationMeger = new YamlConfigurationMerger();
576-
List mergedConfigurations = configurationMeger.getMergedConfigurations(
576+
List mergedConfigurations = configurationMerger.getMergedConfigurations(
577577
newestConfigurations, history, configReader);
578-
return ((Map<String, Set<AceBean>>) mergedConfigurations.get(0))
579-
.keySet();
578+
return ((Map<String, Set<AceBean>>) mergedConfigurations.get(0)).keySet();
580579
}
581580

582581
}

0 commit comments

Comments
 (0)