cancel
Showing results for 
Search instead for 
Did you mean: 

Web Service/CMIS to get members of a group

paulf
Champ in-the-making
Champ in-the-making
Hi all,

I have spent countless hours trying desperately to figure out how to list our all of the users within a group in Alfresco. I am trying to integrate our Alfresco environment into a new website I am building. I need to use web services of some description to do this.

I am hoping someone may be able to help.

So far I have used CMIS (Java) to :

1. Connect to Alfresco
2. Query for the repository names
3. Connect to a repository
4. Get a specific document ID
5. Print our the Principal names for that document (which I am led to believe are the group names)

So I have, I believe, a list of groups in the form of strings. I guess I can also grab the group ID's too.

IT IS NOW I AM GETTING DESPERATE!!

I think I am correct in thinking that CMIS has taken me as far as it can? I don't think I can carry on digging into these groups using CMIS? Am I wrong - perhaps a CMIS query can do this?

So my question is, what is my best approach now? I am on the latest version of Alfresco.

I have read about Web Scripts which I believe are blocks of logic, written in Java, that I upload to Alfresco. That could be problematic. I know there are Alfresco Web Services but I cannot seem to find an easy to follow, ground-up guide to working with them.

Can anyone advise on how best to achieve this query of user groups?

Many thanks for reading.
4 REPLIES 4

rjohnson
Star Contributor
Star Contributor
There is a standard REST API that you can call.

{alfresco-url}/api/groups/{Group-short-Name}/children?authorityType=Person

mrogers
Star Contributor
Star Contributor
Don't think you can do it directly via CMIS.    (You may be able to do a query of the authorities via CMIS 1.1 though.   That may be possible. )  

But there are web scripts available in the alfresco public API to CRUD groups as rjohnson points out.

paulf
Champ in-the-making
Champ in-the-making
Hi guys,

Thanks so much for you help. I really appreciate it.

Just one follow up question if I may.

Although I didn't strictly need to, I went down the path of creating my own web script. Sort of a training process. I would like to confirm whether the output I am seeing is correct.

The web-script simply reads the group name passed in within the URL. The JS file then calls the getMembers() method (obviously in order to get the members of the group). It then adds the resulting array to the model as 'personnames'.

I have a JSON output file which <lists> through the generated model and writes the name of the group out. It does this using  "${person.name}".

My problem is that the output - the 'username' - looks like a GUID e.g. 

person: [
{
name: "2108408d-6c5f-40ef-b581-2d12ceedbdf7"
},
{
name: "fb159b54-1c45-42a5-9837-76a480769d8d"
}
]


What is this ID? More importantly, might you know how I can get the actual user name rather than this, what I assume is, a node reference?

Hope you can help

mrogers
Star Contributor
Star Contributor
could you attach your java script and template file please.