Adding Users to Group(Creating Via Webscript) via API or Java based Webscript

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

Adding Users to Group(Creating Via Webscript) via API or Java based Webscript

I want to add bulk users to different different groups (creating group via Webscripts) uusing API service or Java based Web Script.

 

Thanks,

Pravin Gupta

3 Replies
EddieMay
Alfresco Employee

Re: Adding Users to Group(Creating Via Webscript) via API or Java based Webscript

Hi @PravinGupta,

Take a look at this solution -  it might provide the basis for your own solution.

HTH

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
PravinGupta
Member II

Re: Adding Users to Group(Creating Via Webscript) via API or Java based Webscript

Hi @EddieMay ,

I think solution provided by you is similar to my requirement but what i want is to Create group if Group is not Present and to add user to that Group(Group present by default or Group newly Created). I think createGroup service is to be used here but how to combine my both statement to Create group if not present and to add user to it

 

 

 

Thanks,

Pravin

EddieMay
Alfresco Employee

Re: Adding Users to Group(Creating Via Webscript) via API or Java based Webscript

Hi @PravinGupta,

When you write,  "i want is to Create group if Group is not Present" - you will have to do a group lookup as mentioned in that post I referred to -https://api-explorer.alfresco.com/api-explorer/#!/groups/listGroups. If the group doesn't exist, then you will have to create the group https://api-explorer.alfresco.com/api-explorer/#!/groups/createGroup. To add a person to your existing or new group - https://api-explorer.alfresco.com/api-explorer/#!/groups/createGroupMembership - here's the documentation.

Also look at this api - https://api-explorer.alfresco.com/api-explorer/#!/groups/listGroupMembershipsForPerson & this documentation to see if the user belongs to a group or groups. 

In psuedo code:

if (!group exist) {

create group

add user to group

} else if (!user member of group) {
add user to group
}

I think that might work. Caveat: Not tested!

HTH,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!