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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

wcmmode by user

quo-so
Level 2
Level 2

Is there anyway to set the wcmmode specific to a group or user?  Basically have a user that their wcmmode is always disabled so they can preview the site but not edit it?  but still have other users as content authors that can make edits?

1 Accepted Solution
justin_at_adobe
Correct answer by
Employee
Employee

Hi,
I don't think there's anything like this OOTB, but it should be simple to do as a filter. Just figure out if the current user is one of these users and call WCMMode.DISABLED.toRequest(request);

Regards,

Justin

View solution in original post

2 Replies
quo-so
Level 2
Level 2

k thanks just seeing if there was a more "elegant" way.  for those that need something here's what I created real quick.  Basically on an author instance set users to just read permissions and putting this in your page.jsp will flip the switch to wcmmode=disabled

 

// check permission and change wcm mode on author if ((WCMMode.fromRequest(request) == WCMMode.EDIT)){ Session currentSession = slingRequest.getResourceResolver().adaptTo(Session.class); if (!currentSession.hasPermission(currentPage.getPath(),"set_property")){ WCMMode disabled = WCMMode.DISABLED.toRequest(request); } }
justin_at_adobe
Correct answer by
Employee
Employee

Hi,
I don't think there's anything like this OOTB, but it should be simple to do as a filter. Just figure out if the current user is one of these users and call WCMMode.DISABLED.toRequest(request);

Regards,

Justin

View solution in original post