cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a New User through JavaScript API ?

alexr
Champ in-the-making
Champ in-the-making
Hi Kevin and colleague Alfresco developers,

At this moment I am trying to create a new user (cmSmiley Tongueerson) with the Alfresco JavaScript API.
The people API would seem the most logical, however it doesn't
have a createUser method.
I don't know if a cmSmiley Tongueerson is considered a "Node", but I tried to
create a new person with the createNode method on person.parent

The object person (logged on user) was the "admin" user when
testing the script below:

   
    props = new Array(6);
    props["cm:userName"] = "test";
    props["cm:firstName"] = "Test";
    props["cm:lastName"] = "User";
    props["cm:email"] =    "test@something.com";
    props["cmSmiley SurprisedrganizationId"] = "1234";
    props["cmSmiley Tongueassword"] = "test"
   
    //props["cm:homeFolder"] = companyhome.name;
    //props["cm:homeFolderProvider"] = "";
   
    var tstUser = person.parent.createNode(null, "cmSmiley Tongueerson", props);


Can anybody tell me what's wrong with the above code snippet and how the syntax for creating a new user would look like?

Kind regards,

Alex
2 REPLIES 2

mikeh
Star Contributor
Star Contributor
Hi

As well as creating a cmSmiley Tongueerson node, the repository API creates objects in the userStore which the Javascript API is currently unable to do - it will require a specific extension to the API to create users. Please raise a JIRA item for it, or contribute it back if you decide to do it yourself :wink:

Thanks,
Mike

alexr
Champ in-the-making
Champ in-the-making
Hi Mike,

Thanks for the quick response.

I raised an JIRA item for it:

http://issues.alfresco.com/browse/AR-1949


Regards,

Alex