Exemplo n.º 1
0
  private void listAdmins() {
    this.getAdminsTable().clearTable();
    getProgressPanel().showProgress("Searching...");
    try {
      GridAdministrationClient client = getSessionPanel().getAdminClient();
      List<String> admins = client.getAdmins();

      for (int i = 0; i < admins.size(); i++) {
        this.getAdminsTable().addAdmin(admins.get(i));
      }
      loaded = true;
      getProgressPanel().stopProgress(admins.size() + " administrator(s) found.");

    } catch (PermissionDeniedFault pdf) {
      ErrorDialog.showError(pdf);
      getProgressPanel().stopProgress("Error");
      log.error(pdf, pdf);
    } catch (Exception e) {
      ErrorDialog.showError(e);
      getProgressPanel().stopProgress("Error");
      FaultUtil.logFault(log, e);
    } finally {
      enableAllButtons();
    }
  }
Exemplo n.º 2
0
 public void showAdmin() {
   try {
     GridAdministrationClient client = getSessionPanel().getAdminClient();
     GridUserFilter f = new GridUserFilter();
     f.setGridId(getAdminsTable().getSelectedAdmin());
     List<GridUser> users = client.findUsers(f);
     if ((users == null) || (users.size() == 0)) {
       throw new Exception(
           "The administrator selected does not have an account with this Dorian.");
     } else {
       GridUser user = users.get(0);
       List<TrustedIdP> idps = client.getTrustedIdPs();
       TrustedIdP tidp = null;
       for (int i = 0; i < idps.size(); i++) {
         if (idps.get(i).getId() == user.getIdPId()) {
           tidp = idps.get(i);
           break;
         }
       }
       GridApplication.getContext()
           .addApplicationComponent(
               new UserWindow(getSessionPanel().getSession(), user, tidp), 700, 500);
     }
   } catch (Exception e) {
     ErrorDialog.showError(e);
     FaultUtil.logFault(log, e);
   }
 }
 private void removeAllCertificates() {
   try {
     int selection =
         JOptionPane.showConfirmDialog(
             this, "Are you sure you want to remove all of the listed certificates?");
     if (selection == JOptionPane.YES_OPTION) {
       GridAdministrationClient client = session.getAdminClient();
       int rowCount = getUserCertificates().getRowCount();
       for (int i = 0; i < rowCount; i++) {
         showProgess("Removing certificates...");
         UserCertificateRecord record =
             (UserCertificateRecord) getUserCertificates().getValueAt(0, 0);
         client.removeUserCertificate(record.getSerialNumber());
         getUserCertificates().removeRow(0);
       }
       stopProgess(rowCount + " certificate(s) removed.");
       GridApplication.getContext()
           .showMessage("The listed certificates were successfully removed!!!");
     }
   } catch (Exception e) {
     stopProgess("Error");
     ErrorDialog.showError(e);
     FaultUtil.logFault(log, e);
   }
   enableButtons();
 }
  private void removeCertificate() {
    try {
      int row = getUserCertificates().getSelectedRow();

      if ((row >= 0) && (row < getUserCertificates().getRowCount())) {
        UserCertificateRecord record =
            (UserCertificateRecord) getUserCertificates().getValueAt(row, 0);
        int selection =
            JOptionPane.showConfirmDialog(
                this, "Are you sure you want to remove the selected certificate?");
        if (selection == JOptionPane.YES_OPTION) {
          showProgess("Removing certificate...");
          GridAdministrationClient client = session.getAdminClient();
          client.removeUserCertificate(record.getSerialNumber());
          getUserCertificates().removeRow(row);
          GridApplication.getContext()
              .showMessage("The selected certificates was successfully removed!!!");
          stopProgess("Certificate successfully removed.");
        }
      } else {
        throw new Exception("Please select a certificate!!!");
      }
    } catch (Exception e) {
      ErrorDialog.showError(e);
      stopProgess("Error");
      FaultUtil.logFault(log, e);
    }
    enableButtons();
  }
Exemplo n.º 5
0
 private void removeAdmin() {
   try {
     GridAdministrationClient client = getSessionPanel().getAdminClient();
     client.removeAdmin(getAdminsTable().getSelectedAdmin());
     getAdminsTable().removeSelectedAdmin();
   } catch (Exception e) {
     ErrorDialog.showError(e);
     FaultUtil.logFault(log, e);
   }
 }
  private void findCertificates() {
    try {
      showProgess("Searching...");
      getUserCertificates().clearTable();
      UserCertificateFilter f = new UserCertificateFilter();
      f.setGridIdentity(Utils.clean(getGridIdentity().getText()));
      if (Utils.clean(getUserCertificateSerialNumber().getText()) != null) {
        try {
          f.setSerialNumber(Long.valueOf(Utils.clean(getUserCertificateSerialNumber().getText())));
        } catch (NumberFormatException e) {
          stopProgess("Error");
          enableButtons();
          ErrorDialog.showError("The serial number must be an integer.");
          return;
        }
      }
      if ((searchStartDate != null) && (searchEndDate != null)) {
        if (searchStartDate.after(searchEndDate)) {
          stopProgess("Error");
          enableButtons();
          ErrorDialog.showError("The start date cannot be after the end date.");
          return;
        } else {
          DateRange r = new DateRange();
          r.setStartDate(searchStartDate);
          r.setEndDate(searchEndDate);
          f.setDateRange(r);
        }
      } else if ((searchStartDate == null) && (searchEndDate != null)) {
        stopProgess("Error");
        enableButtons();
        ErrorDialog.showError("You must specify a start date!!!");
        return;
      } else if ((searchStartDate != null) && (searchEndDate == null)) {
        stopProgess("Error");
        enableButtons();
        ErrorDialog.showError("You must specify an end date!!!");
        return;
      }

      f.setNotes(Utils.clean(getNotes().getText()));
      if (getStatus().getSelectedUserStatus() != null) {
        f.setStatus(getStatus().getSelectedUserStatus());
      }
      GridAdministrationClient client = this.session.getAdminClient();
      List<UserCertificateRecord> records = client.findUserCertificateRecords(f);
      getUserCertificates().addUserCertificates(records);
      stopProgess(records.size() + " user certificate(s) found.");
    } catch (Exception e) {
      stopProgess("Error");
      ErrorDialog.showError(Utils.getExceptionMessage(e), e);
      log.error(Utils.getExceptionMessage(e), e);
    }
    enableButtons();
  }