cancel
Showing results for 
Search instead for 
Did you mean: 

Where is the code that share create a account automatically

zengqingyi12
Champ in-the-making
Champ in-the-making
When I configured alfresco share to use passthru SSO authentication, I found when there is no account exist in alfresco, alfresco will create a account with the name automatically when user type:
http://localhost:8080/share
Can someone tell me where is the code which alfresco used to create the account automatically ?
Thanks in advance  !
1 REPLY 1

kevinr
Star Contributor
Star Contributor
The JavaScript APIs to create people are accessable via REST calls to the Alfresco server.

Look at this URL on your deployed Alfresco instance:
http://localhost:8080/alfresco/service/index/uri/
search for /person and /people
- those are the related Webscript api urls that you can call from the web-tier.
Here are the docs: http://wiki.alfresco.com/wiki/Reposi...nce#Add_Person

The people API expects a JSON request, something like this:
var myPerson = {
   "userName":"test1",
   "password":"password",
   "firstName":"Test",
   "lastName":"User",
   "email":"test@test.net",
   "disableAccount":false,
   "quota":-1,
   "groups":[]
};
To call an API like this from a WebScript component JavaScript controller in Share is easy:

var json = jsonUtils.toJSONString(myPerson);
var conn = remote.connect("alfresco");
conn.post("/api/people", json, "application/json");
That will create the person.

Take a look at the "Users" Admin Console page in Alfresco Share and the code behind it (files called users.get.* and users.js) for a more advanced example.

Note that only a logged in Alfresco admin user can create people!