final JahiaGroup priv = groupService.lookupGroup(site.getID(), JahiaGroupManagerService.SITE_PRIVILEGED_GROUPNAME);
Principal p = null;
if (principal.startsWith("u:")) {
p = userManagerService.lookupUser(principal.substring(2));
} else if (principal.length() > 2) {
p = groupService.lookupGroup(site.getID(), principal.substring(2));
}
if (p != null) {
if (needPrivileged && !priv.isMember(p)) {
logger.info(principal + " need privileged access");
priv.addMember(p);