This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git

commit 774a9cfd07bca8065a64b66990cc728e1773d3c7
Author: Marcus Christie <[email protected]>
AuthorDate: Thu Sep 20 14:40:38 2018 -0400

    AIRAVATA-2840 Updates for cred store API changes
---
 app/controllers/AdminController.php |  3 +--
 app/libraries/AdminUtilities.php    | 31 +++++++++++++------------------
 app/libraries/URPUtilities.php      |  4 ++--
 3 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/app/controllers/AdminController.php 
b/app/controllers/AdminController.php
index 23c8e7b..e05d2ce 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -425,7 +425,6 @@ class AdminController extends BaseController {
        public function createSSH(){
         $description = Input::get("description");
         $newToken = AdminUtilities::create_ssh_token_for_gateway($description);
-        $pubkey = AdminUtilities::get_pubkey_from_token( $newToken);
         return 
Redirect::to("admin/dashboard/credential-store")->with("message", "SSH Key was 
successfully created");
        }
 
@@ -642,4 +641,4 @@ class AdminController extends BaseController {
                        return 0;
        }
 
-}
\ No newline at end of file
+}
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index 4620cd3..bd245f7 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -4,7 +4,7 @@ use Airavata\Model\Workspace\Gateway;
 use Airavata\Model\Workspace\GatewayApprovalStatus;
 use Airavata\Model\Workspace\Notification;
 use Airavata\Model\Workspace\NotificationPriority;
-use Airavata\Model\Credential\Store\CredentialOwnerType;
+use Airavata\Model\Credential\Store\SummaryType;
 use Illuminate\Support\Facades\Log;
 
 class AdminUtilities
@@ -310,38 +310,33 @@ class AdminUtilities
     }
 
     public static function create_ssh_token_for_gateway($description) {
-        return Airavata::generateAndRegisterSSHKeys(
-            Session::get('authz-token'), Session::get("gateway_id"), 
Session::get("username"), $description, CredentialOwnerType::GATEWAY);
+        $token = 
Airavata::generateAndRegisterSSHKeys(Session::get('authz-token'), $description);
     }
 
     public static function create_ssh_token_for_user($description) {
-        return Airavata::generateAndRegisterSSHKeys(
-            Session::get('authz-token'), Session::get("gateway_id"), 
Session::get("username"), $description, CredentialOwnerType::USER);
+        return 
Airavata::generateAndRegisterSSHKeys(Session::get('authz-token'), $description);
     }
 
     public static function create_pwd_token($inputs){
         $username = $inputs['username'];
         $password = $inputs['password'];
         $description = $inputs['description'];
-        return $newToken = Airavata::registerPwdCredential( 
Session::get('authz-token'), Session::get("gateway_id"),
-            Session::get("username"), $username, $password, $description);
+        return $newToken = Airavata::registerPwdCredential( 
Session::get('authz-token'),
+            $username, $password, $description);
 
     }
 
-    public static function get_all_ssh_tokens(){
-        return Airavata::getAllGatewaySSHPubKeys( Session::get('authz-token'), 
Session::get("gateway_id") );
-    }
-
     public static function get_all_ssh_tokens_with_description(){
-        return Airavata::getAllCredentialSummaryForGateway( 
Session::get('authz-token'), "SSH", Session::get("gateway_id") );
+        return Airavata::getAllCredentialSummaries( 
Session::get('authz-token'), "SSH");
     }
 
     public static function get_all_pwd_tokens(){
-        return Airavata::getAllGatewayPWDCredentials( 
Session::get('authz-token'), Session::get("gateway_id") );
-    }
-
-    public static function get_pubkey_from_token( $token){
-        return Airavata::getSSHPubKey( Session::get('authz-token'), $token, 
Session::get("gateway_id"));
+        $credential_summaries = 
Airavata::getAllCredentialSummaries(Session::get('authz-token'), 
SummaryType::PASSWD);
+        $result = [];
+        foreach ($credential_summaries as $credential_summary) {
+            $result[$credential_summary->tokenId] = 
$credential_summary->description;
+        }
+        return $result;
     }
 
     public static function remove_ssh_token( $token){
@@ -407,4 +402,4 @@ class AdminUtilities
 
         return true;
     }
-}
\ No newline at end of file
+}
diff --git a/app/libraries/URPUtilities.php b/app/libraries/URPUtilities.php
index 428f139..8cdf889 100644
--- a/app/libraries/URPUtilities.php
+++ b/app/libraries/URPUtilities.php
@@ -67,7 +67,7 @@ class URPUtilities
         $userId = Session::get('username');
         $gatewayId = Session::get('gateway_id');
 
-        $all_ssh_pub_key_summaries = 
Airavata::getAllCredentialSummaryForUsersInGateway(Session::get('authz-token'), 
SummaryType::SSH, $gatewayId, $userId);
+        $all_ssh_pub_key_summaries = 
Airavata::getAllCredentialSummaries(Session::get('authz-token'), 
SummaryType::SSH);
         foreach ($all_ssh_pub_key_summaries as $ssh_pub_key_summary) {
             # strip whitespace from public key: there can't be trailing
             # whitespace in a public key entry in the authorized_keys file
@@ -275,4 +275,4 @@ class URPUtilities
     }
 }
 
-?>
\ No newline at end of file
+?>

Reply via email to