Esempio n. 1
0
  public void runPreProcess() {

    Authorization auth = new glguerin.authkit.imp.macosx.MacOSXAuthorization();
    Privilege priv = new Privilege("system.privilege.admin");
    // see kAuthorizationRightExecute in the AuthorizationTags.h from Security.framework
    int count = 0;
    boolean succeed = false;
    do {
      try {
        auth.authorize(priv, true);
        succeed = true;
        break;
      } catch (Throwable t) {
        System.out.println("Throwable " + t);
      }
      count++;
    } while (count <= 3);

    if (succeed) {
      String preinstallPath = createTemporaryPreinstallFile();
      if (preinstallPath == null) return;
      String[] progArray = {preinstallPath, System.getProperty("user.name")};
      try {
        Process p = auth.execPrivileged(progArray);
        Thread.sleep(1000L);
      } catch (Throwable t) {
        System.out.println("Throwable " + t);
        t.printStackTrace();
      }
    }
  }
Esempio n. 2
0
 ////// Search for item dialog
 private void searchActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_searchActionPerformed
   if (Authorization.authorize(uid, password)) {
     clearTable();
     this.search_dialog.setVisible(true);
   }
 } // GEN-LAST:event_searchActionPerformed
Esempio n. 3
0
 private void requestActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_requestActionPerformed
   if (Authorization.authorize(uid, password)) {
     this.request_dialog.setVisible(true);
   }
 } // GEN-LAST:event_requestActionPerformed