airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [02/10] airavata-php-gateway git commit: super-admin specific gateway provider changes
Date Tue, 12 Jul 2016 23:37:31 GMT
super-admin specific gateway provider changes


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

Branch: refs/heads/grouper-integration
Commit: b6717b5a6c7d77d88c06f18f4afbcf283aca07bd
Parents: 82ef562
Author: Nipurn Doshi <nipunhere@gmail.com>
Authored: Sun Jul 10 00:56:33 2016 -0700
Committer: Nipurn Doshi <nipunhere@gmail.com>
Committed: Sun Jul 10 00:56:33 2016 -0700

----------------------------------------------------------------------
 app/config/pga_config_default_template.php     | 243 ++++++++++++++++++++
 app/controllers/AccountController.php          |  32 ++-
 app/controllers/AdminController.php            |  25 +-
 app/controllers/ComputeResourceController.php  |   4 +
 app/libraries/CRUtilities.php                  |  12 +
 app/views/account/dashboard.blade.php          |  72 +++++-
 app/views/admin/manage-gateway.blade.php       |  43 +---
 app/views/partials/add-gateway-block.blade.php |  40 ++++
 8 files changed, 426 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b6717b5a/app/config/pga_config_default_template.php
----------------------------------------------------------------------
diff --git a/app/config/pga_config_default_template.php b/app/config/pga_config_default_template.php
new file mode 100644
index 0000000..9d6be07
--- /dev/null
+++ b/app/config/pga_config_default_template.php
@@ -0,0 +1,243 @@
+<?php
+return array(
+    /**
+     * *****************************************************************
+     *  These are WSO2 Identity Server Related Configurations
+     * *****************************************************************
+     */
+
+    'wsis' => [
+
+        /**
+         * Admin Role Name
+         */
+        'admin-role-name' => 'admin',
+
+        /**
+         * Read only Admin Role Name
+         */
+        'read-only-admin-role-name' => 'admin-read-only',
+
+        /**
+         * Gateway user role
+         */
+        'user-role-name' => 'airavata-user',
+
+        /**
+         * Tenant Domain
+         */
+        'tenant-domain' => '',
+
+        /**
+         * Tenant admin's username
+         */
+        'admin-username' => 'scigap_admin',
+
+        /**
+         * Tenant admin's password
+         */
+        'admin-password' => 'sci9067@min',
+
+        /**
+         * OAuth client key
+         */
+        'oauth-client-key' => 'fI0fo8luZYsDMPqfIYH8fN6wtfMa',
+
+        /**
+         * OAuth client secret
+         */
+        'oauth-client-secret' => 'cRKUjG8jPUgWj7NxUNT5Tf5621Aa',
+
+        /**
+         * Identity server domain
+         */
+        'server' => 'idp.scigap.org',
+
+        /**
+         * Identity server url
+         */
+        'service-url' => 'https://idp.scigap.org:9443/',
+
+        /**
+         * Enable HTTPS server verification
+         */
+        'verify-peer' => true,
+
+        /**
+         * Path to the server certificate file
+         */
+        'cafile-path' => app_path() . '/resources/security/idp_scigap_org.pem',
+
+        /**
+         * Allow self signed server certificates
+         */
+        'allow-self-signed-cert' => false
+    ],
+
+
+    /**
+     * *****************************************************************
+     *  These are Airavata Related Configurations
+     * *****************************************************************
+     */
+    'airavata' => [
+
+        /**
+         * Airavata API server location. Use tls:// as the protocol to
+         * connect TLS enabled Airavata
+         */
+        'airavata-server' => 'gw56.iu.xsede.org',
+
+        /**
+         * Airavata API server port
+         */
+        'airavata-port' => '8930',
+
+        /**
+         * Airavata API server thrift communication timeout
+         */
+        'airavata-timeout' => '1000000',
+
+        /**
+         * PGA Gateway ID
+         */
+        'gateway-id' => 'scigap',
+
+        /**
+         * Maximum size of a file which is allowed to upload to the server
+         */
+        'server-allowed-file-size' => 64,
+
+        /**
+         * directory in the web server where experiment data is staged. (relative to the
PGA documents root)
+         */
+        'experiment-data-dir' => '/../experimentData',
+
+        /**
+         * absolute path of the data dir
+         */
+        'experiment-data-absolute-path' => 'C:\wamp\www\experimentData',
+
+       /**
+         * username for the user for accessing the experiment data over ssh
+         */
+        'ssh-user' => 'root',
+
+        /**
+         * Advanced experiments options
+         */
+        'advanced-experiment-options' => '',
+
+        /**
+         * Default queue name
+         */
+        'queue-name' => 'long',
+
+        /**
+         * Default node count
+         */
+        'node-count' => '1',
+
+        /**
+         * Default total core count
+         */
+        'total-cpu-count' => '16',
+
+        /**
+         * Default wall time limit
+         */
+        'wall-time-limit' => '30',
+
+        /**
+         * Enable app-catalog cache
+         */
+        'enable-app-catalog-cache' => true,
+
+        /**
+         * Life time of app catalog data cache in minutes
+         */
+        'app-catalog-cache-duration' => 5
+    ],
+
+    /**
+     * *****************************************************************
+     *  Portal Related Configurations
+     * *****************************************************************
+     */
+    'portal' => [
+    /**
+         * Whether this portal is the SciGaP admin portal
+         */
+        'super-admin-portal' => true,
+
+        /**
+         * Set the name of theme in use here
+         */
+        'theme' => 'base',
+
+        /**
+         * Portal title
+         */
+        'portal-title' => 'SciGaP Admin Portal',
+
+        /**
+         * Email address of the portal admin. Portal admin well get email notifications for
events
+         * such as new user creation
+         */
+        'admin-emails' => ['sgg@iu.edu','eroma.abeysinghe@gmail.com','supun.nakandala@gmail.com'],
+
+        /**
+         * Email account that the portal should login to send emails
+         */
+        'portal-email-username' => 'pga.airavata@gmail.com',
+
+        /**
+         * Password for the portal's email account
+         */
+        'portal-email-password' => 'airavata12',
+
+        /**
+         * SMTP server on which the portal should connect
+         */
+        'portal-smtp-server-host' => 'smtp.gmail.com',
+
+        /**
+         * SMTP server port on which the portal should connect
+         */
+        'portal-smtp-server-port' => '587',
+
+        /**
+         * Set JIRA Issue Collector scripts here.
+         */
+        'jira-help' => 
+        [
+            /**
+             * Report Issue Script issued for your app by Atlassian JIRA
+             */
+            'report-issue-script' => '',
+            /**
+             * Collector id at the end of the above script
+             */
+            'report-issue-collector-id' => '',
+            /**
+             * Create Report Script issued for your app by Atlassian JIRA
+             */
+            'request-feature-script' => '',
+            /**
+             * Collector id at the end of the above script
+             */
+            'request-feature-collector-id' => ''
+        ],
+
+        /**
+         * Set Google Analytics Id here. ID format that generates from  
+         * creating tracker object should be 
+         *
+         * UA-XXXXX-Y 
+         *
+         * for it to be working correctly. Currently it is only set for 
+         * sending pageviews.
+         */
+        'google-analytics-id' => ''
+    ]
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b6717b5a/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 7f8e6d1..b042b7a 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -70,9 +70,16 @@ class AccountController extends BaseController
             if(! in_array( "user-pending", $allRoles)){
                 WSIS::addRole( "user-pending");
             }
-            //$userRoles = (array)WSIS::getUserRoles( $username);
 
             $userRoles["new"] = "user-pending";
+
+            if(  Config::get('pga_config.portal')['super-admin-portal'] == true ){
+
+                if(! in_array( "gateway-provider", $allRoles)){
+                    WSIS::addRole( "gateway-provider");
+                }
+                $userRoles["new"] = array("gateway-provider");
+            }
             $userRoles["deleted"] = array();
             WSIS::updateUserRoles( $username, $userRoles);
 
@@ -138,6 +145,10 @@ class AccountController extends BaseController
             if (in_array(Config::get('pga_config.wsis')['user-role-name'], $userRoles)) {
                 Session::put("authorized-user", true);
             }
+            //gateway-provider-code
+            if (in_array("gateway-provider", $userRoles)) {
+                Session::put("gateway-provider", true);
+            }
 
             //only for super admin
             if(  Config::get('pga_config.portal')['super-admin-portal'] == true &&
Session::has("admin")){
@@ -281,7 +292,24 @@ class AccountController extends BaseController
     }
 
     public function dashboard(){
-       return View::make("account/dashboard");
+        //if( Session::has("gateway-provider")){
+            $gatewayOfUser = "";
+            //var_dump( Session::get("authz-token")->accessToken); exit;
+            $userProfile = Session::get("user-profile");
+            $gatewaysInfo = CRUtilities::getAllGateways();
+            foreach( $gatewaysInfo as $index => $gateway){
+                if( $gateway->emailAddress == $userProfile["email"]){
+                    Session::set("gateway_id", $gateway->gatewayId);
+                    $gatewayOfUser = $gateway->gatewayId;
+                    break;
+                }
+            }
+            if( $gatewayOfUser == ""){
+                Session::put("new-gateway-provider");
+            }
+       // }
+
+        return View::make("account/dashboard");
     }
 
     public function resetPassword()

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b6717b5a/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 6825483..f289e07 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -9,7 +9,30 @@ class AdminController extends BaseController {
 	}
 
 	public function dashboard(){
-		return View::make("account/dashboard");
+        $userInfo = array();
+        
+        $userProfile = Session::get("user-profile");
+        Session::forget("new-gateway-provider");
+
+        if( in_array( "gateway-provider", $userProfile["roles"]) ){
+			$gatewayOfUser = "";
+        	$gatewaysInfo = CRUtilities::getAllGateways();
+            foreach( $gatewaysInfo as $index => $gateway){
+                if( $gateway->emailAddress == $userProfile["email"]){
+                    Session::set("gateway_id", $gateway->gatewayId);
+                    $gatewayOfUser = $gateway->gatewayId;
+                    Session::forget("super-admin");
+                    break;
+                }
+            }
+            if( $gatewayOfUser == ""){
+            	$userInfo["username"] = $userProfile["username"];
+            	$userInfo["email"] = $userProfile["email"];
+                Session::put("new-gateway-provider", true);
+            }
+        }
+        //var_dump( $userInfo); exit;
+		return View::make("account/dashboard", array("userInfo"=> $userInfo));
 	}
 
 	public function addAdminSubmit(){

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b6717b5a/app/controllers/ComputeResourceController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ComputeResourceController.php b/app/controllers/ComputeResourceController.php
index d258c2d..c40270c 100755
--- a/app/controllers/ComputeResourceController.php
+++ b/app/controllers/ComputeResourceController.php
@@ -274,6 +274,10 @@ class ComputeResourceController extends BaseController
         ));
 
     }
+
+    public function groupedApplicationsView(){
+        return CRUtilities::getApplicationsByResource();
+    }
 }
 
 ?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b6717b5a/app/libraries/CRUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CRUtilities.php b/app/libraries/CRUtilities.php
index ca0ffa2..042b31a 100755
--- a/app/libraries/CRUtilities.php
+++ b/app/libraries/CRUtilities.php
@@ -453,6 +453,7 @@ class CRUtilities
         else {
             $gateways[0] = Airavata::getGateway(Session::get('authz-token'), Session::get("gateway_id"));
         }
+
         $selectedCRs = array();
         $selectedSRs = array();
         $allCRs = CRUtilities::getAllCRObjects();
@@ -504,6 +505,17 @@ class CRUtilities
         return $gatewaysInfo;
     }
 
+    public static function getAllGateways()
+    {
+
+        if (Session::has("super-admin"))
+            $gateways = Airavata::getAllGateways(Session::get('authz-token'));
+        else {
+            $gateways[0] = Airavata::getGateway(Session::get('authz-token'), Session::get("gateway_id"));
+        }
+        return $gateways;
+    }
+
     public static function updateGatewayProfile( $data){
         $gatewayResourceProfile = Airavata::getGatewayResourceProfile( Session::get('authz-token'),
$data["gateway_id"]);
         $gatewayResourceProfile->credentialStoreToken = $data["cst"];

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b6717b5a/app/views/account/dashboard.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/dashboard.blade.php b/app/views/account/dashboard.blade.php
index ba1a102..58c2d69 100644
--- a/app/views/account/dashboard.blade.php
+++ b/app/views/account/dashboard.blade.php
@@ -19,7 +19,21 @@
         {{ Session::forget("message") }}
         @endif
 
-        @if( Session::has('authorized-user') || Session::has('admin') || Session::has('admin-read-only')
)
+        @if( Session::has('new-gateway-provider') )
+        <div class="row">
+            <div class="col-md-offset-2 col-md-8">
+                <form id="add-tenant-form" action="{{ URL::to("/") }}/provider/add-gateway">
+                    <div class="col-md-12 text-center" style="margin-top:50px;">
+                        <h3>Register your gateway now!</h3>
+                        <button type="button" class="btn btn-default toggle-add-tenant"><span
+                                class="glyphicon glyphicon-plus"></span>Add a new
gateway
+                        </button>
+                    </div>
+                    @include('partials/add-gateway-block', $userInfo)
+                </form>
+            </div>
+        </div>
+        @elseif( Session::has('authorized-user') || Session::has('admin') || Session::has('admin-read-only')
)
         <div class="row text-center breathing-space">
             <h1>Let's get started!</h1>
         </div>
@@ -228,4 +242,60 @@
 
 </div>
 
+@stop
+
+@section('scripts')
+@parent
+<script>
+
+    $(".add-tenant").slideUp();
+
+    $(".toggle-add-tenant").click(function () {
+        $('html, body').animate({
+            scrollTop: $(".toggle-add-tenant").offset().top
+        }, 500);
+        $(".add-tenant").slideDown();
+    });
+
+    $("#add-tenant-form").submit(function (event) {
+        event.preventDefault();
+        event.stopPropagation();
+        var formData = $("#add-tenant-form").serialize();
+        $("#add-gateway-loading").modal("show");
+        $(".loading-gif").removeClass("hide");
+        $.ajax({
+            type: "POST",
+            data: formData,
+            url: '{{ URL::to("/") }}/admin/add-gateway',
+            success: function (data) {
+                if( data.gateway == $(".gatewayName").val() ){
+                    $(".gateway-success").html("Gateway has been added. The page will be
reloaded in a moment.").removeClass("hide");
+                    setTimeout( function(){
+                        location.reload();
+                    }, 2000);
+                }
+                else if( data == 0){
+                    $(".gateway-error").html( "An unknown error occurred while trying to
create the gateway.")
+                                        .removeClass("hide");
+                }
+                else{
+                    errors = data;
+                    $(".gateway-error").html("").removeClass("hide");
+                    for( input in data)
+                    {
+                        $(".gateway-error").append(" -- " + input + " : " + data[input] +
"<br/><br/>");
+                    }
+                }
+            },
+            error: function( data){
+                var error = $.parseJSON( data.responseText);
+                $(".gateway-error").html(error.error.message).removeClass("hide");
+            }
+        }).complete(function () {
+            $("#add-gateway-loading").modal("hide");
+            $(".loading-gif").addClass("hide");
+        });
+    });
+
+</script>
 @stop
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b6717b5a/app/views/admin/manage-gateway.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-gateway.blade.php b/app/views/admin/manage-gateway.blade.php
index 55a6546..3fb69da 100644
--- a/app/views/admin/manage-gateway.blade.php
+++ b/app/views/admin/manage-gateway.blade.php
@@ -59,46 +59,7 @@
                                 class="glyphicon glyphicon-plus"></span>Add a new
gateway
                         </button>
                     </div>
-                    <div class="add-tenant col-md-6">
-                        <div class="form-group required">
-                            <label class="control-label">Enter Domain Name</label>
-                            <input type="text" name="domain" class="form-control" required="required"/>
-                        </div>
-                        <div class="form-group required">
-                            <label class="control-label">Enter Desired Gateway Name</label>
-                            <input type="text" name="gatewayName" class="form-control
gatewayName" required="required"/>
-                        </div>
-                        <div class="form-group required">
-                            <label class="control-label">Enter Admin Email Address</label>
-                            <input type="text" name="admin-email" class="form-control"
required="required"/>
-                        </div>
-                        <div class="form-group required">
-                            <label class="control-label">Enter Admin First Name</label>
-                            <input type="text" name="admin-firstname" class="form-control"
required="required"/>
-                        </div>
-                        <div class="form-group required">
-                            <label class="control-label">Enter Admin Last Name</label>
-                            <input type="text" name="admin-lastname" class="form-control"
required="required"/>
-                        </div>
-                        <div class="form-group required">
-                            <label class="control-label">Enter Admin Username</label>
-                            <input type="text" name="admin-username" class="form-control"
required="required"/>
-                        </div>
-                        <div class="form-group required">
-                            <label class="control-label">Enter Admin Password</label>
-                            <input type="password" name="admin-password" class="form-control"
required="required"/>
-                        </div>
-                        <div class="form-group required">
-                            <label class="control-label">Re-enter Admin Password</label>
-                            <input type="password" name="admin-password-confirm" class="form-control"
required="required"/>
-                        </div>
-                        <div class="form-group required">
-                            <input type="submit" class="col-md-2 form-control btn btn-primary"
value="Register"/>
-                        </div>
-                    </div>
-                    <div class="col-md-6 loading-gif hide"><img  src='{{URL::to('/')}}/assets/ajax-loader.gif'/></div>
-                    <div class="col-md-6 alert alert-danger gateway-error hide"></div>
-                    <div class="col-md-6 alert alert-success gateway-success hide"></div>
+                    @include('partials/add-gateway-block')
                 </form>
             </div>
 
@@ -333,7 +294,7 @@
                     $(".gateway-success").html("Gateway has been added. The page will be
reloaded in a moment.").removeClass("hide");
                     setTimeout( function(){
                         location.reload();
-                    }, 2000);
+                    }, 3000);
                 }
                 else if( data == 0){
                     $(".gateway-error").html( "An unknown error occurred while trying to
create the gateway.")

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b6717b5a/app/views/partials/add-gateway-block.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/add-gateway-block.blade.php b/app/views/partials/add-gateway-block.blade.php
new file mode 100644
index 0000000..c966ccb
--- /dev/null
+++ b/app/views/partials/add-gateway-block.blade.php
@@ -0,0 +1,40 @@
+<div class="add-tenant col-md-6">
+    <div class="form-group required">
+        <label class="control-label">Enter Domain Name</label>
+        <input type="text" name="domain" class="form-control" required="required"/>
+    </div>
+    <div class="form-group required">
+        <label class="control-label">Enter Desired Gateway Name</label>
+        <input type="text" name="gatewayName" class="form-control gatewayName" required="required"/>
+    </div>
+    <div class="form-group required">
+        <label class="control-label">Enter Admin Email Address</label>
+        <input type="text" name="admin-email" class="form-control" required="required"
@if( isset ( $userInfo["email"])) readonly="true" value="{{ $userInfo['email'] }}" @endif/>
+    </div>
+    <div class="form-group required">
+        <label class="control-label">Enter Admin First Name</label>
+        <input type="text" name="admin-firstname" class="form-control" required="required"/>
+    </div>
+    <div class="form-group required">
+        <label class="control-label">Enter Admin Last Name</label>
+        <input type="text" name="admin-lastname" class="form-control" required="required"/>
+    </div>
+    <div class="form-group required">
+        <label class="control-label">Enter Admin Username</label>
+        <input type="text" name="admin-username" class="form-control" required="required"
@if( isset ( $userInfo["username"])) readonly="true" value="{{ $userInfo['username'] }}" @endif/>
+    </div>
+    <div class="form-group required">
+        <label class="control-label">Enter Admin Password</label>
+        <input type="password" name="admin-password" class="form-control" required="required"/>
+    </div>
+    <div class="form-group required">
+        <label class="control-label">Re-enter Admin Password</label>
+        <input type="password" name="admin-password-confirm" class="form-control" required="required"/>
+    </div>
+    <div class="form-group required">
+        <input type="submit" class="col-md-2 form-control btn btn-primary" value="Register"/>
+    </div>
+</div>
+<div class="col-md-6 loading-gif hide"><img  src='{{URL::to('/')}}/assets/ajax-loader.gif'/></div>
+<div class="col-md-6 alert alert-danger gateway-error hide"></div>
+<div class="col-md-6 alert alert-success gateway-success hide"></div>
\ No newline at end of file


Mime
View raw message