cancel
Showing results for 
Search instead for 
Did you mean: 

Create user via resful service [Solved]

michaelc
Champ on-the-rise
Champ on-the-rise
I am having a minor issue with a service I have.
I create a user via a restful service as stated in the documents.

it works except I wanted to set the user disabled and set there skype value.
should work any idea what my be my issue or does this not work as I would expect ?

  service call
  URL POST http://localhost/alfresco/service/api/people
  content type : application/json
  data:
{
   
   "userName": "a44773x",
   "enabled": false,
   "firstName": "Michael",
   "lastName": "Ford",
   "jobtitle": "daskldas",
   "email": "my@email.com",
   "skype": "subscribe"

}

result:
{
   "url": "\/alfresco\/service\/api\/person\/a44773x",
   "userName": "a44773x",
   "enabled": true,
   "firstName": "Michael",
   "lastName": "Ford",
   "jobtitle": "daskldas",
   "organization": null,
   "location": null,
   "telephone": null,
   "mobile": null,
   "email": "my@email.com",
   "companyaddress1": null,
   "companyaddress2": null,
   "companyaddress3": null,
   "companypostcode": null,
   "companytelephone": null,
   "companyfax": null,
   "companyemail": null,
   "skype": null,
   "instantmsg": null,
   "googleusername": null,
   "quota": -1,
   "sizeCurrent": 0,
   "persondescription": null
}
7 REPLIES 7

mikeh
Star Contributor
Star Contributor
Looking in the people.post.json.js webscript it seems we don't read all the parameters.

Please feel free to raise an enhancement request in JIRA.

Thanks,
Mike

michaelc
Champ on-the-rise
Champ on-the-rise
Looking in the webscript it seems we don't read all the parameters.

Please feel free to raise an enhancement request in JIRA.

Thanks,
Mike

My problem on the add. (rtfm)
  on reading again it states on the post username, first, last, email and password.

but on the put it should allow all. I will open one.

So dumb question where is  people.post.json.js ?

michaelc
Champ on-the-rise
Champ on-the-rise
Found people.post.json.js  in alfresco\classes\alfresco\templates\org\alfresco\respository\person

I added

   var enableAccount = ((json.has("disableAccount") && json.get("disableAccount")) == false);
   if (json.has("enabled")) {
       if (json.get("enabled") == false){
           enableAccount = false;
       }
   }
at about line 38

and I added at about 56

   if (json.has("skype"))
   {
      person.properties["skype"] = json.get("skype");
   } 

works like a champ. one question is there a way to extend the alfresco library like the share library without doing it inside the war file ?

mikeh
Star Contributor
Star Contributor
…is there a way to extend the alfresco library like the share library without doing it inside the war file ?
Yes, but use shared/classes/alfresco/extension instead of web-extension.

Thanks,
Mike

michaelc
Champ on-the-rise
Champ on-the-rise
…is there a way to extend the alfresco library like the share library without doing it inside the war file ?
Yes, but use shared/classes/alfresco/extension instead of web-extension.

Thanks,
Mike

thanks
  so that would be /shared/classes/alfresco/extension/org/alfresco/…. ??

mikeh
Star Contributor
Star Contributor
…is there a way to extend the alfresco library like the share library without doing it inside the war file ?
Yes, but use shared/classes/alfresco/extension instead of web-extension.

Thanks,
Mike

thanks
  so that would be /shared/classes/alfresco/extension/org/alfresco/…. ??
Edit: Not quite. It would be

shared/classes/alfresco/extension/templates/webscripts/org/alfresco/…

Mike

michaelc
Champ on-the-rise
Champ on-the-rise
You Rock !!!
Thank you