static String getUserId(NodeImpl tokenNode, UserManager userManager) throws RepositoryException {
if (tokenNode != null) {
final NodeImpl userNode = (NodeImpl) tokenNode.getParent().getParent();
final String principalName = userNode.getProperty(UserImpl.P_PRINCIPAL_NAME).getString();
if (userNode.isNodeType(UserImpl.NT_REP_USER)) {
Authorizable a = userManager.getAuthorizable(new ItemBasedPrincipal() {
public String getPath() throws RepositoryException {
return userNode.getPath();
}
public String getName() {