cancel
Showing results for 
Search instead for 
Did you mean: 

creating users uisng scripting api

pmarreddy
Champ in-the-making
Champ in-the-making
hi,

cansomebody tell me which method i have to use to create users using javascript api.

thanks
prasanth
1 REPLY 1

nparry
Champ in-the-making
Champ in-the-making
I am pretty sure that you cannot.  If you could, that would be great, because I have been attempting to do the same thing.  See this post:

http://forums.alfresco.com/viewtopic.php?t=3698

You can with the java class AdministrationServiceSoapBindingStub.

AuthenticationUtils.startSession("admin", "admin");
         
NewUserDetails newUser = new NewUserDetails(uname, pass, createPersonProperties(homespace, firstName, lastName, email, orgId));
AdministrationServiceSoapBindingStub administrationService = WebServiceFactory.getAdministrationService();
userDetails = administrationService.createUsers(new NewUserDetails[]{newUser});

private NamedValue[] createPersonProperties(String homeFolder, String firstName, String lastName, String email, String orgId){
      return new NamedValue[] {
                new NamedValue(Constants.PROP_USER_HOMEFOLDER, Boolean.FALSE, homeFolder, null),
                new NamedValue(Constants.PROP_USER_FIRSTNAME, Boolean.FALSE, firstName, null),
                new NamedValue(Constants.PROP_USER_LASTNAME, Boolean.FALSE, lastName, null),
                new NamedValue(Constants.PROP_USER_EMAIL, Boolean.FALSE, email, null),
                new NamedValue(Constants.PROP_USER_ORGID, Boolean.FALSE, orgId, null)
       };
}