Expand my Community achievements bar.

SOLVED

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

Avatar

Level 5

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) 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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...

 

View solution in original post

4 Replies

Avatar

Community Advisor

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.



Arun Patidar

Avatar

Correct answer by
Employee Advisor

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...

 

Avatar

Level 1

So as to add OOTB groups to newly created groups via repoinit script follow below steps:

 

1. Create OOTB group via repoinit script

2. ADD  OOTB group to newly created custom group

3. Once AEM loads, OOTB groups permission will be automatically taken care off.

 

scripts=[
"
create group contributor

create group new-custom-group
add new-custom-group to group contributor
"
]

 

Avatar

Administrator
@ashwinkumar_gupta, Thank you for sharing the answer with AEM community. Keep it up.


Kautuk Sahni