01-30-2019 03:14 AM
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?
01-30-2019 08:51 PM
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
01-30-2019 08:51 PM
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
01-31-2019 03:27 AM
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
02-03-2019 03:59 PM
Hi Roberto.
I tried to do what you suggested and i actually turned out to work fine! Thanks a lot.
Best regards
Andreas
Explore our Alfresco products with the links below. Use labels to filter content by product module.