cancel
Showing results for 
Search instead for 
Did you mean: 

How we get the Group of a user

kshirod
Champ in-the-making
Champ in-the-making
In the LoginBean class we have this.username to get the logged in user.
I want to know the GROUP of the logged in user in that class.
Is there any api to get the Groupname…
Plz reply …Do  you want more clarification.
1 REPLY 1

robertito
Champ in-the-making
Champ in-the-making
Hi!

If I understand well, you can take a look at the AuthorityService. You can use the method getAuthorities() to retrieve all authorities for the user or getAuthoritiesForUser(String userName). After that, filter the names that start with the GROUP_ prefix.

In case you want to take a look at the Javadoc:
http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/security/AuthoritySer...

Hope it helps.