cancel
Showing results for 
Search instead for 
Did you mean: 

Create user script

darkmstr
Champ in-the-making
Champ in-the-making
Hello everybody, I'm new using alfresco and I'm having problems with a task in my job.
All I need is to modify or find the way Alfresco inserts, modify or delete users, is there any script that Alfresco uses or something that I can handle ?
I have my own database, with all my users from a mail service, so I've found that I can create a CSV and import it, but I want to make a script or something that allows me everytime I create an user in my mail service is created in Alfresco too.
Any idea will be great, thanks.
9 REPLIES 9

afaust
Legendary Innovator
Legendary Innovator
Hello,

what type of script do you need? Do you mean a JavaScript action / script, or a web script as a remote API you could call from your service?

Regards
Axel

darkmstr
Champ in-the-making
Champ in-the-making
First of all does Alfresco have a script for the user creation, I'm using MySQL so how it makes the insertion ? cause if it is by a script I can call it when I do the insertion in the mail service, but if it isn't by a script how does it work ?
I need to know it's how its the insertion made, not by the UI.
Thanks for your answer.

afaust
Legendary Innovator
Legendary Innovator
Hello,

Alfresco inserts users into the datatabase with dynamically generated SQL (based on MyBatis). The database tables affected are alf_node, alf_node_child_assocs, alf_node_properties, alf_node_aspects, alf_authority and potentially one or two more, all with references / foreign keys to a couple of other, secondary tables. The data structure is very abstract and there is not simple table to just import users - users share the same structure as all the content.
You should never attempt to insert new data into the Alfresco schema via direct access to the database layer. From an external service, the best way would to create users would be to call the CSV upload web script at /alfresco/s/api/people/upload (using POST) - or create your own web script.

Regards
Axel

darkmstr
Champ in-the-making
Champ in-the-making
Sorry if I'm beign stupid or something, but the script that you mentioned is in the all in one installer?
'cause I went to /alfresco/scripts, /alfresco/tomcat/webapps/alfresco/scripts, /alfresco/tomcat/webapps/alfresco/services, and there isn't anything like that.

afaust
Legendary Innovator
Legendary Innovator
Hello,

the web script I mentioned can be called via HTTP on the URI I posted. The actual files reside in different places - the code that handles the actual logic for CSV input and insertion is located in the Java class UserCSVUploadPost (part of the alfresco-remote-api.jar).

Regards
Axel

darkmstr
Champ in-the-making
Champ in-the-making
Thank you I misunderstood.
Now I have a script to import my database to a CSV format, also I can modifiy it that everytime I create an user create a CSV file for that user; however is there any way to import it in Alfresco not using the UI, sorry I'm new at this, and this are my practices for my University.
I have read about Web Services in Alfresco but I don't know how to get to them, also I don't know if they will work for this case, I've already know the problem with accesing directly to the DB layer in alfresco, it is pretty complicated.

afaust
Legendary Innovator
Legendary Innovator
Hello,

this might be usefull: http://radomirml.com/2009/02/13/file-upload-with-httpcomponents-successor-of-commons-httpclient
Of course if you are using a language other than Java, you have to check how you may execute HTTP calls from your environment.

Regards
Axel

darkmstr
Champ in-the-making
Champ in-the-making
Hello,

Thanks for your help I really appreciate it, yesterday my boss found out about this : localhost:8080/alfresco/api/AdministrationService?wsdl
and we saw that this wsdl had a "CreateUsers", "UpdateUsers", "changePassword" and "deleteUsers" function, the problem is that the "createUsers" function is weird  Smiley Surprisedops: it does have a "username", "password" field, but the other fields are "name", "isMultiValue", "value" and "values" and it is twice, so have you used this wsdl ?' is there a place where I can find some info about it ? I've read this in the wiki :

http://wiki.alfresco.com/wiki/Administration_Web_Service
http://dev.alfresco.com/resource/docs/java/remote-api/org/alfresco/repo/webservice/administration/Ad...

We're trying to see if we can use it by a soapclient, but as I told you using this website:

http://soapclient.com/

I don't know how are the users detail, I just know that it is an array but not how it the data in there, or how to really used it.

darkmstr
Champ in-the-making
Champ in-the-making
Nevermind I found use useful use the ifresco library.