public SyncopeUser getUserFromId(final Long userId) throws NotFoundException, UnauthorizedRoleException {
if (userId == null) {
throw new NotFoundException("Null user id");
}
SyncopeUser user = userDAO.find(userId);
if (user == null) {
throw new NotFoundException("User " + userId);
}
SyncopeUser authUser = userDAO.find(SecurityContextHolder.getContext().getAuthentication().getName());
if (authUser == null || !authUser.equals(user)) {
throw new UnauthorizedRoleException(-1L);
}
return user;
}