コード例 #1
0
 @Override
 public void deleteUser(User user) {
   for (Role r : user.getRoles()) {
     user.removeRole(r);
   }
   userCurator.delete(user);
 }
コード例 #2
0
  @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;
  }
コード例 #3
0
  @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;
  }