cancel
Showing results for 
Search instead for 
Did you mean: 

How to add user to administrator group in Java backed WS?

manish
Champ in-the-making
Champ in-the-making
I am creating user in my Java backed webscript and I want to make this user administrator. How can I add this newly created user to the "Administrator" group?
I tried this, but it throws error -

authorityService.addAuthority("Administrators", userName);

How can I achieve this?

TIA,
- Manish
1 REPLY 1

manish
Champ in-the-making
Champ in-the-making
I got this working with this 2 lines of code -

          final String adminGroup = authorityService.getName(AuthorityType.GROUP, "ALFRESCO_ADMINISTRATORS");
          authorityService.addAuthority(adminGroup, userName);

I just needed the right string for Authority.

rgds,
- Manish