airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndo...@apache.org
Subject [1/3] airavata-php-gateway git commit: User role Pending added + Generate Credential Store Token UI Improvement
Date Fri, 11 Dec 2015 06:37:06 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/master df9b90737 -> c45947e7c


User role Pending added + Generate Credential Store Token UI Improvement


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

Branch: refs/heads/master
Commit: 44d0952b6c677e9eea3b9b2d70fd250245b27cfd
Parents: 6889b03
Author: Nipurn Doshi <nipunhere@gmail.com>
Authored: Fri Dec 11 01:31:14 2015 -0500
Committer: Nipurn Doshi <nipunhere@gmail.com>
Committed: Fri Dec 11 01:31:14 2015 -0500

----------------------------------------------------------------------
 app/controllers/AccountController.php | 12 ++++++++++++
 app/controllers/AdminController.php   |  9 ++++++---
 app/libraries/AdminUtilities.php      |  9 ++++++---
 3 files changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/44d0952b/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 24ef916..06c597c 100755
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -74,6 +74,18 @@ class AccountController extends BaseController
             WSIS::registerUserAccount($username, $password, $email, $first_name, $last_name,
                 Config::get('pga_config.wsis')['tenant-domain']);
 
+            /*add user to role - user_pending */
+
+            $allRoles = WSIS::getAllRoles();
+            if(! in_array( "user_pending", $allRoles)){
+                WSIS::addRole( "user_pending");
+            }
+            //$userRoles = (array)WSIS::getUserRoles( $username);
+
+            $userRoles["new"] = "user_pending";
+            $userRoles["deleted"] = array();
+            WSIS::updateUserRoles( $username, $userRoles);
+
             CommonUtilities::print_success_message('Account confirmation request was sent
to your email account');
             return View::make('home');
         }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/44d0952b/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 8d3cad3..da173bd 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -77,7 +77,7 @@ class AdminController extends BaseController {
 		//Session::put("scigap_admin", true);
 		$crData = CRUtilities::getEditCRData();
 		$gateways = CRUtilities::getAllGatewayProfilesData();
-		$tokens = AdminUtilities::get_ssh_tokens();
+		$tokens = AdminUtilities::get_all_ssh_tokens();
 
 		//$dsData = CRUtilities::getAllDataStoragePreferences( $gateways);
 		$gatewayData = array( 
@@ -173,7 +173,7 @@ class AdminController extends BaseController {
 
 	public function credentialStoreView(){
         Session::put("admin-nav", "credential-store");
-        $tokens = AdminUtilities::get_ssh_tokens();
+        $tokens = AdminUtilities::get_all_ssh_tokens();
         //var_dump( $tokens); exit;
 		return View::make("admin/manage-credentials", array("tokens" => $tokens ) );
 	}
@@ -240,7 +240,10 @@ class AdminController extends BaseController {
     }
 
 	public function createSSH(){
-		return AdminUtilities::create_ssh_token();
+		$newToken = AdminUtilities::create_ssh_token();
+		$pubkey = AdminUtilities::get_pubkey_from_token( $newToken);
+		return Response::json( array( "token" => $newToken, "pubkey" => $pubkey));
+
 	}
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/44d0952b/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index 4970e72..90ad544 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -73,8 +73,7 @@ class AdminUtilities
 
     public static function create_ssh_token(){
         try{
-            $token = Airavata::generateAndRegisterSSHKeys( Session::get('authz-token'), Session::get("gateway_id"),
Session::get("username"));
-            return AdminUtilities::get_ssh_tokens();
+            return $newToken = Airavata::generateAndRegisterSSHKeys( Session::get('authz-token'),
Session::get("gateway_id"), Session::get("username"));
         } catch (InvalidRequestException $ire) {
             CommonUtilities::print_error_message('p>Error in creating SSH Handshake. You
might have to enable TLS in pga_config. </p>' .
                 '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
@@ -87,7 +86,11 @@ class AdminUtilities
         }
     }
 
-    public static function get_ssh_tokens(){
+    public static function get_all_ssh_tokens(){
         return Airavata::getAllGatewaySSHPubKeys( 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"));
+    }
 }
\ No newline at end of file


Mime
View raw message