Ejemplo n.º 1
0
  private Result createViewRole(Button button, Role role, boolean redirect) {
    Result result = new Result();
    Screen next;
    next = new Screen(this, button.destination());
    if (redirect) {
      next.makeRedirect();
    }
    // Integer usrId = user.getId();
    result = listPrivileges(role);
    next.setValue(Screen.VIEW_ROLE, role);
    next.setValue(Screen.AVAILABLE_ENTITIES, application.getManagers());
    next.setValue(Screen.AVAILABLE_PRIVILEGES, Privilege.values());

    result.objectValue(next);

    result.success();
    return result;
  }
Ejemplo n.º 2
0
  private Result createViewUser(Screen.Button button, User user, boolean redirect) {
    Result result = new Result();
    Screen next;
    next = new Screen(this, button.destination());
    if (redirect) {
      next.makeRedirect();
    }
    // Integer usrId = user.getId();

    next.setValue(Screen.VIEW_USER, user);
    List<Role> roleList = new ArrayList<Role>();
    result = listRoles(user, roleList); // TODO check if successful

    List<Role> allRoles = new ArrayList<Role>();
    result = listAllRoles(allRoles);

    subtractRolesNotAssigned(allRoles, roleList);

    next.setValue(Screen.USER_ROLES, roleList);
    next.setValue(Screen.AVAILABLE_ROLES, allRoles);
    result.objectValue(next);
    result.success();
    return result;
  }