var sites = siteService.listUserSites(authorityName);
for each(var site in sites)
{
if(site.shortName != null || authorityName != null)
{
if(site.isMember(authorityName))
{
logger.log("nodeUser ==> " + user.person.properties.userName);
// add to results
results.push(
{
item: createPersonResult(user.person),
selectable: true
});
}
}
}
if(site.isMember(authorityName))
{
logger.log("nodeUser ==> " + user.person.properties.userName);
}
var memberships = site.listMembers("", "", 0, false);
for (userName in memberships)
{
if (userName.match("^GROUP_"))
{
logger.log("Member is Group Type");
}
else
{
authorities['_' + userName] = people.getPerson(userName);
}
}
Donc la variable authorities['_' + userName].properties.userName retourne l'ensemble des utilisateurs membre de site. Mais il y'a forcément de doublons si un utilisateur est membre sur plusieurs sites ==> c'est à dire si l'utilisateur X est par exemple membre sur 3 sites il sera affiché 3 fois.ça me retourne au problème précédent.
var memberships = site.listMembers("", "", 0, true);
Ceci te permettra de récupérer tous les utilisateurs membres du site, y compris ceux dans des groupes.
//Liste des users enregistres dans le repository
var searchResults = groups.searchUsers(searchTerm, paging, "lastName");
for each(var user in searchResults)
{
//userName
var authorityName = user.userName;
//liste des sites associés aux users
var sites = siteService.listUserSites(authorityName);
for each(var site in sites)
{
if(site.shortName != null || authorityName != null)
{
//recupere la liste des membres par site
var memberships = site.listMembers("", "", 0, true);
for (userName in memberships)
{
var memberName = people.getPerson(userName).properties.userName;
}
}
}
Bon je vais voir si je peux supprimer quelques boucles.
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.