cancel
Showing results for 
Search instead for 
Did you mean: 

Delete a user group using alfresco SDK

ajay7
Champ in-the-making
Champ in-the-making
Hi all,

I am new to user management  in alfresco and i am working on alfresco SDK.

i have created a new user group in alfresco sdk using the following code

AuthorityService authorityService=serviceRegistry.getAuthorityService();
authorityService.createAuthority(AuthorityType.GROUP, null, "Ajay_Group_NEW");


my question is now i want to delete  user group  "Ajay_Group_NEW"  using SDK?

i have tried with 2 options 
1.authorityService.removeAuthority(null, "Ajay_Group_NEW");
2. authorityService.deleteAuthority("Ajay_Group_NEW");

both are not working

what is the option? pls help
3 REPLIES 3

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

Try this.


authorityService.deleteAuthority(authorityService.getName(AuthorityType.GROUP,"Ajay_Group_NEW"));


This is because, internally all group names are prefixed by GROUP_ and best way is to call getName and then delete the authority like above.
This way even if the prefix is changed your code will not break.

Best Regards,
Shagul

ajay7
Champ in-the-making
Champ in-the-making
Thks a lot… that was a perfect solution

ajay7
Champ in-the-making
Champ in-the-making
one more doubt,

if i create a group in alfresco, where the group details like group name and others will be stored in database?