@Override
 public void deleteUser(User user) {
   for (Role r : user.getRoles()) {
     user.removeRole(r);
   }
   userCurator.delete(user);
 }
  @Override
  public boolean validateUser(String username, String password) {
    User user = this.userCurator.findByLogin(username);
    String hashedPassword = Util.hash(password);

    if (user != null && password != null && hashedPassword != null) {
      return hashedPassword.equals(user.getHashedPassword());
    }

    return false;
  }
  @Override
  public Role createRole(Role role) {
    Set<User> actualUsers = new HashSet<User>();

    for (User user : role.getUsers()) {
      User actualUser = findByLogin(user.getUsername());
      actualUsers.add(actualUser);
    }
    role.setUsers(actualUsers);

    for (PermissionBlueprint permission : role.getPermissions()) {
      permission.setRole(role);
    }

    this.roleCurator.create(role);
    return role;
  }