Not able to Add OOTB groups to newly created groups via repoinit script

Avatar

Avatar

khamat_bn

Avatar

khamat_bn

khamat_bn

27-03-2021

We have written a repoinit script to add OOTB groups to custom groups but getting the error in script while deploying to AEM cloud.(working fine in local) 

That is because of script is running earlier than the OOTB group creation. Its failing while building image in cloud. 

So we want to add OOTB groups to custom groups automatically instead of manually. 

Is there any way instead of manual work ?

 

Below are logs for build image execution in AEM cloud pipeline.

 

 

27.01.2021 06:19:54.906 *INFO* [Apache Sling Repository Startup Thread #1] org.apache.sling.jcr.repoinit.impl.GroupMembershipVisitor Adding members '[global-librarian, asset-consumers]' to group 'contributor' 

27.01.2021 06:19:54.911 *ERROR* [Apache Sling Repository Startup Thread #1] com.adobe.granite.repository.impl.SlingRepositoryManager Exception in a SlingRepositoryInitializer, SlingRepository service registration aborted 

java.lang.RuntimeException: contributor is not a group 

at org.apache.sling.jcr.repoinit.impl.GroupMembershipVisitor.visitAddGroupMembers(GroupMembershipVisitor.java:52) [org.apache.sling.jcr.repoinit:1.1.28] 

at org.apache.sling.repoinit.parser.operations.AddGroupMembers.accept(AddGroupMembers.java:40) [org.apache.sling.repoinit.parser:1.6.2] 

at org.apache.sling.jcr.repoinit.impl.JcrRepoInitOpsProcessorImpl.apply(JcrRepoInitOpsProcessorImpl.java:56) [org.apache.sling.jcr.repoinit:1.1.28] 

at org.apache.sling.jcr.repoinit.impl.RepositoryInitializerFactory.processRepository(RepositoryInitializerFactory.java:126) [org.apache.sling.jcr.repoinit:1.1.28] 

at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.executeRepositoryInitializers(AbstractSlingRepositoryManager.java:610) [org.apache.sling.jcr.base:3.1.6] 

at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.initializeAndRegisterRepositoryService(AbstractSlingRepositoryManager.java:558) [org.apache.sling.jcr.base:3.1.6] 

at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.access$300(AbstractSlingRepositoryManager.java:92) [org.apache.sling.jcr.base:3.1.6] 

at org.apache.sling.jcr.base.AbstractSlingRepositoryManager$4.run(AbstractSlingRepositoryManager.java:527) [org.apache.sling.jcr.base:3.1.6] 

27.01.2021 06:19:54.918 *INFO* [Apache Sling Repository Startup Thread #1] com.adobe.granite.repository.impl.SlingRepositoryManager Stop requested 

 

Contributor group is creating after running repoinit script 

 

27.01.2021 06:20:07.751 *INFO* [Apache Sling Repository Startup Thread #1] com.adobe.granite.security.user.internal.audit.AuditAuthorizableAction Group 'contributor' was created 

27.01.2021 06:20:07.780 *WARN* [Apache Sling Repository Startup Thread #1] org.apache.jackrabbit.oak.security.user.UserImporter New member of Group 'contributor': No such authorizable (NodeID = 429bbd5b-46a6-3c3d-808b-5fd4219d5c4d) 

 

AEM repoinit security User Access user group User Management

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

jbrar

Employee

Avatar

jbrar

Employee

jbrar
Employee

29-03-2021

Repoint does initialize before any content[1] is loaded to the repo. So, you will have to find an alternate approach to add the OOTB group to the custom group.

 

One approach I could think of is to do it via custom code when your code initializes for the first time after AEM restart 

 

[1] https://experienceleague.adobe.com/docs/experience-manager-cloud-service/implementing/deploying/over...

 

Answers (1)

Answers (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

882

Avatar

Arun_Patidar

MVP

Total Posts

3.1K

Likes

1.2K

Correct Reply

882
Arun_Patidar
MVP

28-03-2021

you can write this logic in your bundle as well, on bundle activator class.

As soon s the bundle is activated, it will add a custom group to the contributor group.