You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/07/19 15:01:38 UTC
[sling-org-apache-sling-feature-cpconverter] branch SLING-8586
updated: SLING-8586 - [cp2fm] "create service user" repoinit instruction
throws javax.jcr.nodetype.ConstraintViolationException
This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a commit to branch SLING-8586
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git
The following commit(s) were added to refs/heads/SLING-8586 by this push:
new ca027b5 SLING-8586 - [cp2fm] "create service user" repoinit instruction throws javax.jcr.nodetype.ConstraintViolationException
ca027b5 is described below
commit ca027b541bb36d310ba40bc7936ef311f26a3431
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Fri Jul 19 17:01:28 2019 +0200
SLING-8586 - [cp2fm] "create service user" repoinit instruction throws
javax.jcr.nodetype.ConstraintViolationException
make sure useful system paths are created only once
---
.../sling/feature/cpconverter/acl/DefaultAclManager.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/feature/cpconverter/acl/DefaultAclManager.java b/src/main/java/org/apache/sling/feature/cpconverter/acl/DefaultAclManager.java
index b30c4a1..5a31386 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/acl/DefaultAclManager.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/acl/DefaultAclManager.java
@@ -47,6 +47,8 @@ public final class DefaultAclManager implements AclManager {
private final Set<SystemUser> preProvidedSystemUsers = new LinkedHashSet<>();
+ private final Set<Path> preProvidedSystemPaths = new HashSet<>();
+
private final Set<Path> preProvidedPaths = new HashSet<>();
private final Set<SystemUser> systemUsers = new LinkedHashSet<>();
@@ -113,7 +115,7 @@ public final class DefaultAclManager implements AclManager {
for (SystemUser systemUser : systemUsers) {
// TODO does it harm?!?
- formatter.format("create path (rep:AuthorizableFolder) %s%n", systemUser.getPath());
+ addSystemUserPath(formatter, systemUser.getPath());
// make sure all users are created first
@@ -183,6 +185,12 @@ public final class DefaultAclManager implements AclManager {
return false;
}
+ private final void addSystemUserPath(Formatter formatter, Path path) {
+ if (preProvidedSystemPaths.add(path)) {
+ formatter.format("create path (rep:AuthorizableFolder) %s%n", path);
+ }
+ }
+
@Override
public void addNodetypeRegistrationSentence(String nodetypeRegistrationSentence) {
if (nodetypeRegistrationSentence != null) {