Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM6.3 providing access to group for a particular component on a page on author

Avatar

Avatar
Validate 25
Level 4
srinivas_chann1
Level 4

Likes

19 likes

Total Posts

222 posts

Correct Reply

6 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
Level 4
srinivas_chann1
Level 4

Likes

19 likes

Total Posts

222 posts

Correct Reply

6 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
srinivas_chann1
Level 4

16-07-2020

Hi,

 

Could some one help me the below query

 

On Author if there is any way that on page where there are many custom components are available.I mean the components   that at code level will under /apps/project

 

For a specific component  on that page how to restrict the edit access to a particular  group .

 

So that users of that particular group can edit the dialog where as for other users the dialog appears hidden or in disabled state

 

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,260 likes

Total Posts

3,140 posts

Correct Reply

886 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,260 likes

Total Posts

3,140 posts

Correct Reply

886 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

16-07-2020

Please check this article I have written for same

https://aemlab.blogspot.com/2018/11/aem-restrict-component-editing-and.html

 

In component Model you can write a check or you can write a filter as well, if you have more than one component.

 

try {
   boolean decoration=false;
   User currentUser = request.getResourceResolver().adaptTo(User.class);
   
   if(currentUser.isAdmin())
    return;
   
   Iterator<Group> currentUserGroups = currentUser.memberOf();

   while (currentUserGroups.hasNext()) {
    Group grp = (Group) currentUserGroups.next();
    if(grp.getID().equals(GROUP)) {
     decoration =true;
     return;
    }
   }

   ComponentContext cc = WCMUtils.getComponentContext(request);
   cc.setDecorate(decoration);
  } catch (Exception e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
   logger.info(e.getMessage());
  }

Answers (1)

Answers (1)

Avatar

Avatar
Give Back 5
Employee
vanegi
Employee

Likes

388 likes

Total Posts

377 posts

Correct Reply

147 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile

Avatar
Give Back 5
Employee
vanegi
Employee

Likes

388 likes

Total Posts

377 posts

Correct Reply

147 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile
vanegi
Employee

16-07-2020

This can be done by just removing permissions of that component for those particular users, you can do groups segregation and add users on those groups ,which has permission to access those components.

 

Capture.JPG