This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
hi there
I read the Adobe CQ documentation about CUG, it is saying to create links within an non-protected page. but I would like to have inside JSP code of the page a condition to check user group and show different content. is it possible?
Since the target of any links to the CUG Realm are not visible to the anonymous user, the linkchecker will remove such links.
To avoid this, it is advisable to create non-protected redirect pages that point to pages within the CUG Realm. The navigation entries are then rendered without causing the linkchecker any problems. Only when actually accessing the redirect page will the user be redirected inside the CUG Realm - after successfully providing their login credentials.
Solved! Go to Solution.
Views
Replies
Total Likes
get the session user and use the memberOf() method in the Authorizable API to find the groups of the logged in user and build logic.
ex code
Session session = resourceResolver.adaptTo(Session.class); UserManager userManager = resourceResolver.adaptTo(UserManager.class); /* to get the current user */ Authorizable auth = userManager.getAuthorizable(session.getUserID()); /* to get the groups it is member of */ Iterator<Group> groups = auth.memberOf();
Views
Replies
Total Likes
get the session user and use the memberOf() method in the Authorizable API to find the groups of the logged in user and build logic.
ex code
Session session = resourceResolver.adaptTo(Session.class); UserManager userManager = resourceResolver.adaptTo(UserManager.class); /* to get the current user */ Authorizable auth = userManager.getAuthorizable(session.getUserID()); /* to get the groups it is member of */ Iterator<Group> groups = auth.memberOf();
Views
Replies
Total Likes
I would not use the code to decide if you should show certain content or not. Rather use permissions and handle the exception if the user is not allowed to read the content. This gives you more flexibility, as you just need to adjust ACLs/CUGs, but never any config of groups, which is then evaluated by your code.
kind regards,
Jörg
Views
Replies
Total Likes
What is your use case? What kind of content is it you wish to switch for users?
Regards,
Opkar
Views
Replies
Total Likes
hi Opkar
thanks for getting back
So the client web site has a CUG page which redirects to login,
then the main page of that section has an image and a link to the another page, but depending of the group of the logged user, it should be shown 1 or another. Same for another menu.
Currently this main page has 4 versions.
So client asked to have just one page.
How do you understand this now?
Let me know.
Thanks
Views
Replies
Total Likes
hi
i created 1 container component and in it's bean put this code to check logged user groups and return a boolean.
then in JSP checked it and depending on this value div was there or not. So it is solved now.
thank you for your help.
Xena
Views
Replies
Total Likes