cancel
Showing results for 
Search instead for 
Did you mean: 

Get groups/roles of current user with Public Java API

itzamna
Confirmed Champ
Confirmed Champ
Hi folks,

maybe you can help me again: The use-case is, that I've to check whether the current user belongs to a pre-defined group or pre-defined role. This should happen in a Java written behaviour class.
I've found already a few approches (like: https://forums.alfresco.com/forum/developer-discussions/alfresco-api/get-user-groups-08032009-1423) but all of them are using the class "AuthorityService" at the end. Unfortunately this class is currently not Alfresco Public API: http://docs.alfresco.com/4.2/concepts/java-public-api-list.html

Are there any other solutions on how I can get all groups/roles where the user belongs to?

Thanks,
Itzamna
3 REPLIES 3

lutz_horn
Champ in-the-making
Champ in-the-making
You can easily get the AuthorityService in Java:

<java>
AuthorityService authorityService = serviceRegistry.getAuthorityService();
</java>

Hi Lutz,

thanks for the answer. Unfortunately this class is not in the list of Alfresco Public API. Therefore I cannot use it. Is there any workaround only with public API?

BR

lutz_horn
Champ in-the-making
Champ in-the-making
I don't understand why you can't use it? Why ist this list so important?