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

cancel
Showing results for 
Search instead for 
Did you mean: 
P_Projects
Member II

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

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
piyush48
Established Member

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

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
Member II

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

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.

P_Projects
Member II

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

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