You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2016/10/28 16:46:00 UTC
[11/20] airavata-php-gateway git commit: AIRAVATA-2156 User can add
credential with description
AIRAVATA-2156 User can add credential with description
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/11dcac8b
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/11dcac8b
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/11dcac8b
Branch: refs/heads/develop
Commit: 11dcac8b776426640f8fe0f8f9a314edbb9e1cd0
Parents: 4ffaa68
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Oct 27 08:55:37 2016 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Oct 27 08:55:37 2016 -0400
----------------------------------------------------------------------
app/controllers/AccountController.php | 11 ++++++++++-
app/libraries/AdminUtilities.php | 19 ++++++++++++-------
app/routes.php | 1 +
app/views/account/credential-store.blade.php | 10 ++++++++++
4 files changed, 33 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/11dcac8b/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index ccd3305..615fe73 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -494,6 +494,15 @@ class AccountController extends BaseController
return Redirect::to("account/credential-store")->with("message", "SSH Key '$description' is now the default");
}
+ public function addCredential() {
+
+ $description = Input::get("credential-description");
+
+ if (AdminUtilities::create_ssh_token_with_description($description)) {
+ return Redirect::to("account/credential-store")->with("message", "SSH Key '$description' was added");
+ }
+ }
+
public function deleteCredential() {
$credentialStoreToken = Input::get("credentialStoreToken");
@@ -501,7 +510,7 @@ class AccountController extends BaseController
$description = $credentialSummaryMap[$credentialStoreToken]->description;
if (AdminUtilities::remove_ssh_token($credentialStoreToken)) {
- return Redirect::to("account/credential-store")->with("message", "SSH Key '$description' is was deleted");
+ return Redirect::to("account/credential-store")->with("message", "SSH Key '$description' was deleted");
}
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/11dcac8b/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index bf7116a..d514cce 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -40,7 +40,7 @@ class AdminUtilities
$gateway->identityServerPasswordToken = $inputs["admin-password"];
$gateway->reviewProposalDescription = $inputs["project-details"];
$gateway->gatewayPublicAbstract = $inputs["public-project-description"];
-
+
$userProfile = Session::get("user-profile");
$gateway->requesterUsername = $userProfile["username"];
@@ -66,7 +66,7 @@ class AdminUtilities
$gateway->gatewayName = $gatewayData["gatewayName"];
$gateway->declinedReason = $gatewayData["declinedReason"];
}
-
+
if( isset($gatewayData["createTenant"])){
if( AdminUtilities::add_tenant( $gateway) )
$gateway->gatewayApprovalStatus = GatewayApprovalStatus::APPROVED;
@@ -169,6 +169,11 @@ class AdminUtilities
return $newToken = Airavata::generateAndRegisterSSHKeys( Session::get('authz-token'), Session::get("gateway_id"), Session::get("username"));
}
+ public static function create_ssh_token_with_description($description){
+ return Airavata::generateAndRegisterSSHKeysWithDescription(
+ Session::get('authz-token'), Session::get("gateway_id"), Session::get("username"), $description);
+ }
+
public static function create_pwd_token($inputs){
$username = $inputs['username'];
$password = $inputs['password'];
@@ -211,17 +216,17 @@ class AdminUtilities
$notification->notificationId = $notifData["notificationId"];
if( Airavata::updateNotification( Session::get("authz-token"), $notification) )
{
- return json_encode( Airavata::getNotification( Session::get('authz-token'),
- Session::get("gateway_id"),
+ return json_encode( Airavata::getNotification( Session::get('authz-token'),
+ Session::get("gateway_id"),
$notifData["notificationId"] ));
}
else
0;
}
else
- return Airavata::getNotification(
- Session::get('authz-token'),
- Session::get("gateway_id"),
+ return Airavata::getNotification(
+ Session::get('authz-token'),
+ Session::get("gateway_id"),
Airavata::createNotification( Session::get("authz-token"), $notification) );
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/11dcac8b/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index a81816f..bfe5ee9 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -50,6 +50,7 @@ Route::post("allocation-request", "AccountController@allocationRequestSubmit");
Route::get("account/credential-store", "AccountController@getCredentialStore");
Route::post("account/set-default-credential", "AccountController@setDefaultCredential");
+Route::post("account/add-credential", "AccountController@addCredential");
Route::post("account/delete-credential", "AccountController@deleteCredential");
Route::get("account/computeResources", "AccountController@getComputeResources");
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/11dcac8b/app/views/account/credential-store.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/credential-store.blade.php b/app/views/account/credential-store.blade.php
index a29d7f7..690e47a 100644
--- a/app/views/account/credential-store.blade.php
+++ b/app/views/account/credential-store.blade.php
@@ -32,6 +32,16 @@
<button type="submit" class="btn btn-default">Update default</button>
</form>
+ <h3>Add SSH Key</h3>
+ <form class="form-inline" action="{{ URL::to('/') }}/account/add-credential" method="post">
+ <div class="form-group">
+ <label for="defaultToken" class="sr-only">Description for new SSH key</label>
+ <input type="text" id="credential-description" name="credential-description"
+ class="form-control" placeholder="Description" />
+ </div>
+ <button type="submit" class="btn btn-default">Add</button>
+ </form>
+
<h3>SSH Key Info</h3>
<table class="table table-bordered table-condensed" style="word-wrap: break-word; table-layout: fixed; width: 100%;">
<thead>