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/01 06:40:58 UTC
[sling-org-apache-sling-feature-cpconverter] branch master updated:
SLING-8544 - [cp2fm] service users need to be created with intermediate
path
This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git
The following commit(s) were added to refs/heads/master by this push:
new 676985b SLING-8544 - [cp2fm] service users need to be created with intermediate path
676985b is described below
commit 676985bc1bf31b2f9dd8601a7a80332e48941063
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Mon Jul 1 08:40:51 2019 +0200
SLING-8544 - [cp2fm] service users need to be created with intermediate
path
'create service' operation always first, then 'create path'
---
.../feature/cpconverter/acl/DefaultAclManager.java | 10 ++++------
.../sling/feature/cpconverter/acl/AclManagerTest.java | 7 +++----
.../handlers/RepPolicyEntryHandlerTest.java | 18 ++++--------------
.../handlers/SystemUsersEntryHandlerTest.java | 3 +--
4 files changed, 12 insertions(+), 26 deletions(-)
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 77eff54..b1816e8 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
@@ -108,15 +108,13 @@ public final class DefaultAclManager implements AclManager {
for (SystemUser systemUser : systemUsers) {
List<Acl> authorizations = acls.remove(systemUser.getId());
- // make sure all paths are created first
+ // make sure all users are created first
- addPaths(authorizations, packageAssembler, formatter);
+ formatter.format("create service user %s with path %s%n", systemUser.getId(), systemUser.getPath().getFileName());
- // create then the users
+ // create then the paths
- String path = systemUser.getPath().getName(systemUser.getPath().getNameCount() - 1).toString();
- formatter.format("create path (rep:AuthorizableFolder) /home/users/system/%s%n", path);
- formatter.format("create service user %s with path %s%n", systemUser.getId(), path);
+ addPaths(authorizations, packageAssembler, formatter);
// finally add ACLs
diff --git a/src/test/java/org/apache/sling/feature/cpconverter/acl/AclManagerTest.java b/src/test/java/org/apache/sling/feature/cpconverter/acl/AclManagerTest.java
index b0f845e..5ae7cd8 100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/acl/AclManagerTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/acl/AclManagerTest.java
@@ -72,10 +72,9 @@ public class AclManagerTest {
assertNotNull(repoinitExtension);
// acs-commons-on-deploy-scripts-service will be missed
- String expected = "create path (sling:Folder) /asd\n" +
- "create path (sling:Folder) /asd/public\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
- "create service user acs-commons-package-replication-status-event-service with path public\n" +
+ String expected = "create service user acs-commons-package-replication-status-event-service with path public\n" +
+ "create path (sling:Folder) /asd\n" +
+ "create path (sling:Folder) /asd/public\n" +
"set ACL for acs-commons-package-replication-status-event-service\n" +
"allow jcr:read,crx:replicate,jcr:removeNode on /asd/public\n" +
"end\n" +
diff --git a/src/test/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java b/src/test/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java
index 5cecbf0..e39c660 100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java
@@ -86,34 +86,28 @@ public final class RepPolicyEntryHandlerTest {
assertNotNull(repoinitExtension);
assertEquals(ExtensionType.TEXT, repoinitExtension.getType());
- String expected = "create path (sling:Folder) /asd\n" +
+ String expected = "create service user acs-commons-ensure-oak-index-service with path public\n" +
+ "create path (sling:Folder) /asd\n" +
"create path (sling:Folder) /asd/public\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
- "create service user acs-commons-ensure-oak-index-service with path public\n" +
"set ACL for acs-commons-ensure-oak-index-service\n" +
"allow jcr:read,rep:write,rep:indexDefinitionManagement on /asd/public restriction(rep:glob,*/oak:index/*)\n" +
"end\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
"create service user acs-commons-dispatcher-flush-service with path public\n" +
"set ACL for acs-commons-dispatcher-flush-service\n" +
"allow jcr:read,crx:replicate,jcr:removeNode on /asd/public\n" +
"end\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
"create service user acs-commons-package-replication-status-event-service with path public\n" +
"set ACL for acs-commons-package-replication-status-event-service\n" +
"allow jcr:read,rep:write,jcr:readAccessControl,jcr:modifyAccessControl on /asd/public\n" +
"end\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
"create service user acs-commons-ensure-service-user-service with path public\n" +
"set ACL for acs-commons-ensure-service-user-service\n" +
"allow jcr:read,rep:write,jcr:readAccessControl,jcr:modifyAccessControl on /asd/public\n" +
"end\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
"create service user acs-commons-automatic-package-replicator-service with path public\n" +
"set ACL for acs-commons-automatic-package-replicator-service\n" +
"allow jcr:read on /asd/public\n" +
"end\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
"create service user acs-commons-on-deploy-scripts-service with path public\n" +
"set ACL for acs-commons-on-deploy-scripts-service\n" +
"allow jcr:read on /asd/public\n" +
@@ -131,24 +125,20 @@ public final class RepPolicyEntryHandlerTest {
assertNotNull(repoinitExtension);
assertEquals(ExtensionType.TEXT, repoinitExtension.getType());
- String expected = "create path (sling:Folder) /asd\n" +
+ String expected = "create service user acs-commons-package-replication-status-event-service with path public\n" +
+ "create path (sling:Folder) /asd\n" +
"create path (sling:Folder) /asd/public\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
- "create service user acs-commons-package-replication-status-event-service with path public\n" +
"set ACL for acs-commons-package-replication-status-event-service\n" +
"allow jcr:read,rep:write,jcr:readAccessControl,jcr:modifyAccessControl on /asd/public\n" +
"end\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
"create service user acs-commons-ensure-service-user-service with path public\n" +
"set ACL for acs-commons-ensure-service-user-service\n" +
"allow jcr:read,rep:write,jcr:readAccessControl,jcr:modifyAccessControl on /asd/public\n" +
"end\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
"create service user acs-commons-automatic-package-replicator-service with path public\n" +
"set ACL for acs-commons-automatic-package-replicator-service\n" +
"allow jcr:read on /asd/public\n" +
"end\n" +
- "create path (rep:AuthorizableFolder) /home/users/system/public\n" +
"create service user acs-commons-on-deploy-scripts-service with path public\n" +
"set ACL for acs-commons-on-deploy-scripts-service\n" +
"allow jcr:read on /asd/public\n" +
diff --git a/src/test/java/org/apache/sling/feature/cpconverter/handlers/SystemUsersEntryHandlerTest.java b/src/test/java/org/apache/sling/feature/cpconverter/handlers/SystemUsersEntryHandlerTest.java
index 9e1d440..efb6d14 100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/handlers/SystemUsersEntryHandlerTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/handlers/SystemUsersEntryHandlerTest.java
@@ -75,8 +75,7 @@ public class SystemUsersEntryHandlerTest {
assertEquals(ExtensionType.TEXT, repoinitExtension.getType());
assertTrue(repoinitExtension.isRequired());
- String expected = "create path (rep:AuthorizableFolder) /home/users/system/asd-index-definition-reader\n" +
- "create service user asd-share-commons-asd-index-definition-reader-service with path asd-index-definition-reader\n";
+ String expected = "create service user asd-share-commons-asd-index-definition-reader-service with path asd-index-definition-reader\n";
String actual = repoinitExtension.getText();
assertEquals(expected, actual);
}