cancel
Showing results for 
Search instead for 
Did you mean: 

obtain the coordinator users from a space with a java functi

elenaor
Champ in-the-making
Champ in-the-making
Hello,

I would like to make a java function in which I could obtain all the users with the coordinator role from a specific space. I have read many posts and a I have some ideas, but I don´t have found the answer yet.

Some ideas:


    FacesContext fc = FacesContext.getCurrentInstance();
    ServiceRegistry services = Repository.getServiceRegistry(fc);
    NavigationBean navigator = (NavigationBean)     FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);

    NodeRef space = navigator.getCurrentNode().getNodeRef();

    //Once I have the current space, I would like to get its users. (And what I don't have any idea about is how to insert the coordinator role comparision

// I don't know if the following code is correct
     services.getNodeService().getProperty(space, ContentModel.PROP_USERNAME));
 

Another ideas from
http://forums.alfresco.com/viewtopic.php?t=5140:


NodeRef peopleRef = personService.getPeopleContainer();
         List<ChildAssociationRef> childRefs = nodeService.getChildAssocs(peopleRef);
         for (ChildAssociationRef ref: childRefs)
         {
            // get the NodeRef of the person
            NodeRef personRef = ref.getChildRef();
            if (nodeService.getType(nodeRef).equals(ContentModel.TYPE_PERSON))
            {
               … do some work with person properties here …
            }
         }
2 REPLIES 2

elenaor
Champ in-the-making
Champ in-the-making
Hello,

I have solved this issue yet.

kevinr
Star Contributor
Star Contributor
You need to use the PermissionService to get the list of permissions (use the getAllSetPermissions() method) and the users that are applied to the space. You can then examine the data returned looking for the Coordinator role in the results.

The best code to look at is in this class: org.alfresco.web.bean.users.UserMembersBean
in the getUsers() method.

Hope this helps,

Kevin
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.