示例#1
0
  private void updateRoles() {
    final User user = this.getInstance();
    final List<Integer> addedRoles = new ArrayList<Integer>();
    final List<Integer> removedRoles = new ArrayList<Integer>();
    for (final UIRoleUserData role : roles) {
      if (role.getChecked() && !user.isInRole(role.getId())) addedRoles.add(role.getId());
      else if (!role.getChecked() && user.isInRole(role.getId())) removedRoles.add(role.getId());
    }

    for (final Integer role : removedRoles) user.removeRole(role);

    for (final Integer role : addedRoles) user.addRole(EntityUtilities.getRoleFromId(role));
  }
示例#2
0
 public void populate() {
   this.roles = EntityUtilities.getUserRoles(this.getInstance());
 }