if (!user.getUsername().equals(EntitlementUtil.getAuthenticatedUsername())) {
Set<Long> roleIds = user.getRoleIds();
Set<Long> adminRoleIds = EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames());
roleIds.removeAll(adminRoleIds);
if (!roleIds.isEmpty()) {
throw new UnauthorizedRoleException(roleIds);
}
}
return user;
}