You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/08/03 17:03:08 UTC

[17/50] airavata-php-gateway git commit: Fix for 2477

Fix for 2477


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/937ee2b6
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/937ee2b6
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/937ee2b6

Branch: refs/heads/master
Commit: 937ee2b6b726cd6391294d3f4d553382f227ab9b
Parents: 944ffea
Author: Sneha Tilak <ti...@Snehas-MacBook-Pro.local>
Authored: Wed Jul 5 06:25:57 2017 -0500
Committer: Sneha Tilak <ti...@Snehas-MacBook-Pro.local>
Committed: Wed Jul 5 06:25:57 2017 -0500

----------------------------------------------------------------------
 app/libraries/AdminUtilities.php | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/937ee2b6/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index 03a2402..7d6f33e 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -28,7 +28,11 @@ class AdminUtilities
         $gateway->gatewayAdminEmail = $inputs["admin-email"];
         $gateway->gatewayAdminLastName = $inputs["admin-lastname"];
         $gateway->identityServerUserName = $inputs["admin-username"];
-        $token = create_pwd_token([Session::get('username'), $inputs["admin-password"]]);
+        $token = AdminUtilities::create_pwd_token([
+            "username" => $inputs["admin-username"],
+            "password" => $inputs["admin-password"],
+            "description" => "Admin user password for Gateway " . $id
+        ]);
         $gateway->identityServerPasswordToken  = $token;
         $gateway->reviewProposalDescription = $inputs["project-details"];
         $gateway->gatewayPublicAbstract = $inputs["public-project-description"];
@@ -79,7 +83,9 @@ class AdminUtilities
     public static function request_gateway( $inputs)
     {
         $gateway = new Gateway( $inputs);
-        $gateway->gatewayId = $inputs["gateway-name"];
+        $id = preg_replace('~^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$~', '', $inputs["gateway-name"]);
+        $id = strtolower(preg_replace('~[^a-zA-Z0-9]+~', '-', $id));
+        $gateway->gatewayId = $id;
         $gateway->gatewayApprovalStatus = GatewayApprovalStatus::APPROVED;
         //$gateway->domain = 'airavata.' . $inputs["gateway-acronym"];
         $gateway->gatewayName = $inputs["gateway-name"];
@@ -89,7 +95,11 @@ class AdminUtilities
         $gateway->gatewayAdminFirstName = $inputs["admin-firstname"];
         $gateway->gatewayAdminLastName = $inputs["admin-lastname"];
         $gateway->identityServerUserName = $inputs["admin-username"];
-        $token = create_pwd_token([Session::get('username'), $inputs["admin-password"]]);
+        $token = AdminUtilities::create_pwd_token([
+            "username" => $inputs["admin-username"],
+            "password" => $inputs["admin-password"],
+            "description" => "Admin user password for Gateway " . $id
+        ]);
         $gateway->identityServerPasswordToken  = $token;
         $gateway->reviewProposalDescription = $inputs["project-details"];
         $gateway->gatewayPublicAbstract = $inputs["public-project-description"];
@@ -118,7 +128,11 @@ class AdminUtilities
         $gateway->emailAddress = $gatewayData["email-address"];
         $gateway->gatewayURL = $gatewayData["gateway-url"];
         $gateway->identityServerUserName = $gatewayData["admin-username"];
-        $token = create_pwd_token([Session::get('username'), $gatewayData["admin-password"]]);
+        $token = AdminUtilities::create_pwd_token([
+            "username" => $gatewayData["admin-username"],
+            "password" => $gatewayData["admin-password"],
+            "description" => "Admin user password for Gateway " . $gatewayId
+        ]);
         $gateway->identityServerPasswordToken  = $token;
         $gateway->gatewayAdminFirstName = $gatewayData["admin-firstname"];
         $gateway->gatewayAdminLastName = $gatewayData["admin-lastname"];