@Override @Transactional public boolean changeAdminRole(long userId) { User loggedInUser = findLoggedInUser(); User user = repository.findOne(userId); if (loggedInUser.getId().equals(user.getId())) { return user.isAdmin(); } user.setAdmin(!user.isAdmin()); repository.save(user); return user.isAdmin(); }
@Override @Transactional public void afterPropertiesSet() throws Exception { if (repository.count() > 0) { return; } saveNew(defaultUser.getEmail(), true); User u = findByEmail(defaultUser.getEmail()); changePassword(u.getId(), defaultUser.getPassword()); }