Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save svendahlstrand/5262097 to your computer and use it in GitHub Desktop.
Save svendahlstrand/5262097 to your computer and use it in GitHub Desktop.
SiteVision: lista alla användare i en grupp.
var settings = {
groupMetadataName: 'staffGroup'
};
var utils = request.getAttribute('sitevision.utils');
var session = request.getAttribute('sitevision.jcr.session');
var directoryUtil = utils.getDirectoryUtil();
var propertyUtil = utils.getPropertyUtil();
var currentPage = utils.getPortletContextUtil().getCurrentPage();
var groupId = propertyUtil.getString(currentPage, settings.groupMetadataName);
var group = session.getNodeByIdentifier(groupId);
var members = propertyUtil.getStrings(group, 'member');
for (var i = 0; i < members.size(); i++) {
members.set(i, session.getNodeByIdentifier(members.get(i)));
}
var settings = {
groupDN: 'cn=test,dc=sitevision,dc=se'
};
var utils = request.getAttribute('sitevision.utils');
var session = request.getAttribute('sitevision.jcr.session');
var directoryUtil = utils.getDirectoryUtil();
var propertyUtil = utils.getPropertyUtil();
var group = directoryUtil.getNodeByDN(settings.groupDN);
var members = propertyUtil.getStrings(group, 'member');
for (var i = 0; i < members.size(); i++) {
members.set(i, session.getNodeByIdentifier(members.get(i)));
}
<ul>
#foreach ($user in $members)
<li>$propertyUtil.getString($user, 'displayName')</li>
#end
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment