if (SecurityUtils.userHasRole(shadowedUser, SYSTEMADMIN))
throw new UserShadowedException("Site '" + site.getIdentifier() + "' account '" + user + "' is shadowing the system account");
else if (SecurityUtils.userHasRole(shadowedUser, SITEADMIN))
throw new UserShadowedException("Site '" + site.getIdentifier() + "' account '" + user + "' is shadowing the site account");
else
throw new UserExistsException("Site '" + site.getIdentifier() + "' account '" + user + "' already exists");
}
} else {
logger.warn("Directory service not found, site '{}' user '{}' cannot be checked for user shadowing", site.getIdentifier(), user);
}