cancel
Showing results for 
Search instead for 
Did you mean: 

Get user details for an Alfresco space

andreim
Champ in-the-making
Champ in-the-making
Hi,

I need to use a web UI to communicate with Alfresco.
I want to ask if there is a web API that can be used to get some information from a space.
I am looking for something similar to the WCM API "Get Membership" , that uses the /alfresco/service/api/wcm/webprojects/{webprojectref}/memberships/{username} URL to get the details of an user in a specified webProject.

Thanks in advance for your replies.
1 REPLY 1

andreim
Champ in-the-making
Champ in-the-making
I've managed to get the role of all the users in a space by using this script:
script:
{
    var pathSegments = url.match.split("/");
    var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/"));
    var theNode = cmis.findNode(pathSegments[2], reference);   
    if (theNode === null)
    {
        status.code = 404;
        status.message = "Repository " + pathSegments[2] + " " + reference.join("/") + " not found";
        status.redirect = true;
        break script;
    }
    var permissions = theNode.getPermissions();
    var permissionString = "";
    permissionString = permissionString + permissions;
    model.permissions = permissionString;
}

The description file :
<webscript>
  <shortname>Retrieve list of permissions (getPermissionsCustom)</shortname>
  <description>
<![CDATA[
Gets the list of permissions each user has in the specified space.
]]>
  </description>
  <url>/api/node/{store_type}/{store_id}/{id}/getPermissionsCustom</url>
  <url>/api/path/{store_type}/{store_id}/{id}/getPermissionsCustom</url>
  <authentication>guest</authentication>
  <transaction allow="readonly"/>
  <format default="html">argument</format>
  <family>CMIS</family>
</webscript>
The ftl file:
<html>
<body>
<p>Permissions : ${permissions}</p>
</body>
</html>