cancel
Showing results for 
Search instead for 
Did you mean: 

How to create users in alfresco using DotCmis

shivtechno
Champ in-the-making
Champ in-the-making

Hi,

How do i create user in alfresco using dotcmis

kindly suggest.

Regards,

Shiv

1 ACCEPTED ANSWER

jpotts
World-Class Innovator
World-Class Innovator

Cesar is correct, the CMIS specification does not provide for user or group management.

The Alfresco API can do what you need. You can write your own web script that leverages either the JavaScript API or the Java API to create users. Or you can leverage the out-of-the-box REST API to create people and assign them to groups.

You should be able to find a lot of examples of people creating users with the Alfresco REST API. Here is one.

View answer in original post

9 REPLIES 9

cesarista
World-Class Innovator
World-Class Innovator

Hi:

In principle CMIS 1.1 is very useful with id based CRUD on custom types and metadata operations (and more...), but CMIS is an standard with limited specs for DM and does not know about workflows in Alfresco for example. You can query users in CMIS 1.1, update some properties, or set simple ACLs... but I think it is not possible to create users, groups or assign users in groups. For these tasks, use REST API.

This post can help you to see some of the initial limitations of CMIS 1.0 and how to solve them via cmis:item support.

Cool things you can do in Alfresco with cmis:item support | ECM Architect 

Regards.

--C.

shivtechno
Champ in-the-making
Champ in-the-making

can i use below API for create new user in alfresco

http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom 

cesarista
World-Class Innovator
World-Class Innovator

With CMIS 1.0, it is not possible.

Regards.

--C. 

shivtechno
Champ in-the-making
Champ in-the-making

Then what is the solution for this.. 

Regards,

Shivkumar

jpotts
World-Class Innovator
World-Class Innovator

Cesar is correct, the CMIS specification does not provide for user or group management.

The Alfresco API can do what you need. You can write your own web script that leverages either the JavaScript API or the Java API to create users. Or you can leverage the out-of-the-box REST API to create people and assign them to groups.

You should be able to find a lot of examples of people creating users with the Alfresco REST API. Here is one.

shivtechno
Champ in-the-making
Champ in-the-making

ok i understand but other than webscript can we use this api in C# and add user to alfresco it it possible

I was tried with below code but user not created 

any solution please suggest..

var url = "http://127.0.0.1:8080/alfresco/service/api/people";//admin:nove
var userInfo = { userName: "testcreatesuer", password: "testpassword", firstName: "testfirst", lastName: "testlast", email: "testemail@test.com", disableAccount: false, quote: -1, groups: [] };
console.log(JSON.stringify(userInfo));
$.ajax({
headers: {
'Accept': 'application/json',
'Content-Type': 'text/plain'
},
username: 'admin',
password: 'nove',
type: 'POST',
url: url,
data: JSON.stringify(userInfo),
dataType: 'application/json',
success: function (response) {
console.log("success");
},
error: function (response) {
console.log("Error Occured");
}
});

jpotts
World-Class Innovator
World-Class Innovator

You are setting your content-type to "text/plain" when it should be "application/json" because what you are posting is JSON, not plain text.

shivtechno
Champ in-the-making
Champ in-the-making

var url = "http://admin:nove@127.0.0.1:8080/alfresco/service/api/people";//admin:nove

var userInfo = { userName: "testcreatesuer123161", password: "testpassword", firstName: "testfirst", lastName: "testlast", email: "testemail@test.com", disableAccount: false, quote: -1, groups: [] };

$.ajax({
headers: {
'Content-Type': 'application/json'
},
type: 'POST',
url: url,
crossDomain: true,
asyn:false,
data: JSON.stringify(userInfo),
dataType: 'jsonp',
success: function (response) {
console.log("success");
},
error: function (response) {
console.log("Error Occured");
}
});
});

i am using jsonp also but still there is error like unexpected token