if (userDirectoryRef != null) {
SystemDirectory systemDirectory = (SystemDirectory) bundleContext.getService(userDirectoryRef);
User siteAdmin = site.getAdministrator();
if (siteAdmin != null) {
logger.debug("Checking site '{}' admin user '{}' for shadowing of system account");
User shadowedUser = systemDirectory.loadUser(siteAdmin.getLogin(), site);
if (shadowedUser != null && SecurityUtils.userHasRole(shadowedUser, SystemRole.SYSTEMADMIN)) {
throw new IllegalStateException("Site '" + site.getIdentifier() + "' administrative account '" + siteAdmin.getLogin() + "' is shadowing the system account");
}
}
} else {