How to create users in alfresco using DotCmis

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
shivtechno
Member II

How to create users in alfresco using DotCmis

Jump to solution

Hi,

How do i create user in alfresco using dotcmis

kindly suggest.

Regards,

Shiv

1 Solution

Accepted Solutions
jpotts
Advanced II

Re: How to create users in alfresco using DotCmis

Jump to solution

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.

9 Replies
cesarista
Advanced

Re: How to create users in alfresco using DotCmis

Jump to solution

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
Member II

Re: How to create users in alfresco using DotCmis

Jump to solution

can i use below API for create new user in alfresco

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

cesarista
Advanced

Re: How to create users in alfresco using DotCmis

Jump to solution

With CMIS 1.0, it is not possible.

Regards.

--C. 

shivtechno
Member II

Re: How to create users in alfresco using DotCmis

Jump to solution

Then what is the solution for this.. 

Regards,

Shivkumar

jpotts
Advanced II

Re: How to create users in alfresco using DotCmis

Jump to solution

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
Member II

Re: How to create users in alfresco using DotCmis

Jump to solution

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

shivtechno
Member II

Re: How to create users in alfresco using DotCmis

Jump to solution

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
Advanced II

Re: How to create users in alfresco using DotCmis

Jump to solution

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
Member II

Re: How to create users in alfresco using DotCmis

Jump to solution

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