Example #1
0
 /**
  * Fetch the user's public ssh keys.
  */
 function sshKeys()
 {
     // NOTE: This is a candidate for caching on the HTTP session
     /* If I don't have an inside cert/key, I can't sign the call.
      * Return no keys. */
     if (!$this->certificate()) {
         return array();
     }
     $ma_url = get_first_service_of_type(SR_SERVICE_TYPE::MEMBER_AUTHORITY);
     $keys = lookup_private_ssh_keys($ma_url, $this, $this->account_id);
     return $keys;
 }
Example #2
0
        $_SESSION['lastmessage'] = "Updated SSH keypair (name='" . $_REQUEST['name'] . "'" . $desc . ")";
    } else {
        if (!isset($result) || is_null($result) || print_r($result, True) == '') {
            $result = "Error";
        }
        $_SESSION['lastmessage'] = "Failed to update SSH keypair ({$result})";
    }
    relative_redirect('profile.php');
} else {
    // User has requested edit
    show_header('GENI Portal: Profile');
    include "tool-breadcrumbs.php";
    print "<h1>Edit SSH Key</h1>";
    if (array_key_exists('id', $_REQUEST)) {
        $ma_url = get_first_service_of_type(SR_SERVICE_TYPE::MEMBER_AUTHORITY);
        $ssh_keys = lookup_private_ssh_keys($ma_url, $user, $user->account_id);
        $ssh_key = NULL;
        foreach ($ssh_keys as $one_key) {
            if ($one_key['id'] == $_REQUEST['id']) {
                $ssh_key = $one_key;
            }
        }
        if ($ssh_key != NULL && array_key_exists('HTTP_REFERER', $_SERVER)) {
            $cancel_dest = $_SERVER['HTTP_REFERER'];
        } else {
            // If no referer, go to home page on cancel.
            $cancel_dest = relative_url('profile.php');
        }
        show_ssh_edit_form($ssh_key, $cancel_dest);
        js_delete_ssh_key();
        $delete_sshkey_url = relative_url('deletesshkey.php?');