Example #1
0
  protected void headerComponents() {

    boolean canCreateStore = getService().canCreateStore();

    WebMarkupContainer h = new WebMarkupContainer("header");
    add(h);

    if (!canCreateStore) {
      h.add(
          new Label("message", new StringResourceModel("noCreateStore", this, null))
              .add(new AttributeAppender("class", new Model("info-link"), " ")));
    } else {
      h.add(
          new Label("message", new Model())
              .add(new AttributeAppender("class", new Model("displayNone"), " ")));
    }

    // the add button
    h.add(
        add =
            new Link("addNew") {
              @Override
              public void onClick() {
                setResponsePage(new NewUserPage(serviceName).setReturnPage(this.getPage()));
              }
            });

    // <NewUserPage><NewUserPage>("addNew", NewUserPage.class));
    // add.setParameter(AbstractSecurityPage.ServiceNameKey, serviceName);
    add.setVisible(canCreateStore);

    // the removal button
    h.add(
        removal =
            new SelectionUserRemovalLink(serviceName, "removeSelected", users, dialog, false));
    removal.setOutputMarkupId(true);
    removal.setEnabled(false);
    removal.setVisible(canCreateStore);

    h.add(
        removalWithRoles =
            new SelectionUserRemovalLink(
                serviceName, "removeSelectedWithRoles", users, dialog, true));
    removalWithRoles.setOutputMarkupId(true);
    removalWithRoles.setEnabled(false);
    removalWithRoles.setVisible(
        canCreateStore
            && GeoServerApplication.get()
                .getSecurityManager()
                .getActiveRoleService()
                .canCreateStore());
  }
Example #2
0
 protected void onBeforeRender() {
   users.clearSelection();
   removal.setEnabled(false);
   removalWithRoles.setEnabled(false);
   super.onBeforeRender();
 }