Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

wcmmode by user

Avatar

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

Avatar

Correct answer by
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

Avatar

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); } }

Avatar

Correct answer by
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