Last active
May 21, 2016 21:00
-
-
Save svendahlstrand/5262097 to your computer and use it in GitHub Desktop.
SiteVision: lista alla användare i en grupp.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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