Get users in group via a paging result using the AuthorityService

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

Get users in group via a paging result using the AuthorityService

Jump to solution

Hi,

Is it possible to get the users from an Alfresco group as a paging result by using the AuthorityService in Java?

I have been looking at the methods of the AuthorityService but I cannot find an appropriate method to do this. The methods that come closest to what I need are these two:

public PagingResults<String> getAuthorities(AuthorityType type, String zoneName, String displayNameFilter, boolean sortByDisplayName, boolean sortAscending, PagingRequest pagingRequest);

and

public Set<String> getContainedAuthorities(AuthorityType type, String name, boolean immediate);

The former method can provide a paging result as needed, but not for a specific group only, and the latter can provide the users for a specific group but not as a paging result. Is there a way in which I can get the combined functionality of these two methods, i.e. get the users in a given group as a paging result?

1 Solution

Accepted Solutions
roberto_gamiz
Established Member II

Re: Get users in group via a paging result using the AuthorityService

Jump to solution

Hello,

You could try to encapsulate the call to getContainedAuthorities in a function that accept a PagingRequest parameter and return a PagingResults value.

You must handle yourself the creation of the object PagingResults in the new function.

Regards

View solution in original post

3 Replies
roberto_gamiz
Established Member II

Re: Get users in group via a paging result using the AuthorityService

Jump to solution

Hello,

You could try to encapsulate the call to getContainedAuthorities in a function that accept a PagingRequest parameter and return a PagingResults value.

You must handle yourself the creation of the object PagingResults in the new function.

Regards

kring
Member II

Re: Get users in group via a paging result using the AuthorityService

Jump to solution

Hi Roberto,

Thank you for your reply and your suggestion. Unfortunately, I do not think that it will work in my case due to performance issues. Some of the groups in my Alfresco system have a large number of users (~1500), so the call to getContainedAuthorities will be the bottleneck, i.e. this call will probably be the time consuming part of the processing. But I will investigate your idea further - otherwise I will have to make some more low-level calls to Alfresco - maybe make a call to the DB directly instead of using the AuthorityService. I can also see that there is an AuthoityDAO interface which may be of use.

Best regards

Andreas

kring
Member II

Re: Get users in group via a paging result using the AuthorityService

Jump to solution

Hi Roberto.

I tried to do what you suggested and i actually turned out to work fine! Thanks a lot.

Best regards

Andreas