Is there a script to create new user and assign it to a group

1
0
-1

hi, i want to create a new user using a variables like first name, last name , and email , group . please i need this script . also i want to know how can i send an email to all the users in the same time .thanks a lot

1 answer

1
0
-1

You will have to use the IdentityAPI and MembershipAPI

for example

createUser
User createUser(String userName,
              String password,
              String firstName,
              String lastName)
                throws AlreadyExistsException,
                       CreationException

Will create the user (see documentataion here: [createUser][], and to add the user to a group see [here][] .

Something like:

import IdentlyAPI;
import MembershipAPI;

def userName = "john.smith"
def defaultpwd = "bpm"
def firstName = "John";
def lastName = "Smith"

def userGroup = group("groupPath").getid()

def userID = createUser(userName, defaultpwd, firstName, lastName)
def groupID = addMembership(userId, userGroup, roleId)

NOTE: This is sample pseudo code, you will need to complete it to get it to work. I've not done this before, just pointing you in the right direction.

In fact you could also look at the documentation here to see how it is really done in a process.

http://documentation.bonitasoft.com/create-new-user http://documentation.bonitasoft.com/add-user-group

regards

[createUser]: http://documentation.bonitasoft.com/javadoc/api/6.3/org/bonitasoft/engin...(java.lang.String, java.lang.String, java.lang.String, java.lang.String) [here]: http://documentation.bonitasoft.com/javadoc/api/6.3/org/bonitasoft/engin...(long, long, long)

Notifications