cancel
Showing results for 
Search instead for 
Did you mean: 

How to get all the roles(Custom or OOTB) from the User site

P_Projects
Champ in-the-making
Champ in-the-making

Hello All,

 I want to get all roles whether it is custom or OOTB  present under the Users site for using it.

Since i have seen only a way to get role of a current user only. So whether it is possible to get all the roles from the site??

Thanks.

3 REPLIES 3

piyush48
Star Contributor
Star Contributor

Hi,

I think this piece of code may help you out for your requirement:-

public ScriptableHashMap<String, String> getSitePermissionGroups()
    {
        if (this.siteRoleGroups == null)
        {
            List<String> roles = this.siteService.getSiteRoles(
                    this.siteInfo.getShortName()
            );
            this.siteRoleGroups = new ScriptableHashMap<String, String>();
            for (String role : roles)
            {
                this.siteRoleGroups.put(
                        role, 
                        this.siteService.getSiteRoleGroup(this.siteInfo.getShortName(), role));
            }
        }
        return this.siteRoleGroups;
    }

See you will get Groups associated with all the roles present in your site.

Please apply and get back to me.

Thanks,

Piyush Patel

P_Projects
Champ in-the-making
Champ in-the-making

Hi,

Could you provide me the whole approach or code which i should add to the piece of code you provided to me.

Or please someone can you please help me out by providing whole steps to follow or where should i add this code on my SDK. Since i am new to Alfresco any help regarding this will be very helpful.

Thanks.

Hi all,

Please someone could guide me through it though @piyush48  tried to help me but could someone please provide code and path where i should place it.

I am new in alfresco and have urgent requirement for this.

Thanks,

Piyush