cancel
Showing results for 
Search instead for 
Did you mean: 

[Alfresco 4.2d] Check if user in a group to show/hide items in header

tetsubo
Champ in-the-making
Champ in-the-making
What is the best way to check if one user is in a certain group and depending on that to display/hide items from the share header? (Alfresco 4.2d)


Is there a better solution besides:
https://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/check-if-user-gro...

..maybe something as "sexy" as user.isAdmin like user.isMemberOfGroup({shortName})?


Please help!
2 REPLIES 2

niketapatel
Star Contributor
Star Contributor
I dont think any API is available in Share/Surf to check if user is in particular group.

Surf does have user object and all possible properties are listed here - http://docs.alfresco.com/4.1/topic/com.alfresco.enterprise.doc/references/APISurf-user.html

So you can do as described in that forum using repository webscript


And header links you can hide/show based on configuration too by adding condition in link as below in share-config-custom.xml

<item type="link" id="people" condition="user.isAdmin" >/people-finder</item> 

tetsubo
Champ in-the-making
Champ in-the-making
thank you for the response, niketapatel, I did the group check with the repo webscript. Btw. I am using the alfresco 4.2d new header, so share-config-custom.xml is not working for me (legacy mode disabled).