Give permission to a Group by using Workflows | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Amuthesan
AmuthesanAccepted solution
Level 2
January 10, 2020
Level 3
January 14, 2020

Thanks, for the help, i have implemented the same code from this. But when i am trying to add a group to another group as members, It is not getting added and no Error is also displaying.

Map<String, Object> subServiceParameters = new HashMap<>();
subServiceParameters.put(ResourceResolverFactory.SUBSERVICE, GlobalConstants.SERVICE_USER_MAPPER_NAME);
ResourceResolver resourceResolver = resourceResolverFactory.getServiceResourceResolver(subServiceParameters);

UserManager userManager = workflowSession.adaptTo(ResourceResolver.class).adaptTo(UserManager.class);
Group group = (Group) userManager.getAuthorizable("COMPANY_ADMINISTRATORS");
group.addMember(userManager.getAuthorizable("COMPANY_TAG_ADMINISTRATORS"));
Session session = resourceResolver.adaptTo(Session.class);
session.save();