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/02/15 14:38:35 UTC

[01/12] airavata-php-gateway git commit: fixing AIRAVATA-2265 : in SciGaP latest record should be on top of the list in Gateway requests.

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/dreg-gateway 003801168 -> 75929d779


fixing AIRAVATA-2265 : in SciGaP latest record should be on top of the list in Gateway requests.


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

Branch: refs/heads/dreg-gateway
Commit: f436e6a5227a703562f17b9f460f8350b10937da
Parents: dae6cd7
Author: scnakandala <su...@gmail.com>
Authored: Mon Jan 30 10:50:40 2017 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Mon Jan 30 10:50:40 2017 -0500

----------------------------------------------------------------------
 app/controllers/AdminController.php | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f436e6a5/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 9735b9a..d0aa3e5 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -99,12 +99,18 @@ class AdminController extends BaseController {
 
     }
 
+	private function cmp($a, $b)
+	{
+		return strcmp($b->requestCreationTime, $a->requestCreationTime);
+	}
+
     public function gatewayView(){
     	//only for super admin
 		//Session::put("super-admin", true);
 		
 		$gatewaysInfo = CRUtilities::getAllGatewayProfilesData();
 		$gateways = $gatewaysInfo["gateways"];
+		usort($gateways, array($this, "cmp"));
 		$tokens = AdminUtilities::get_all_ssh_tokens();
 		$pwdTokens = AdminUtilities::get_all_pwd_tokens();
 		$srData = SRUtilities::getEditSRData();


[04/12] airavata-php-gateway git commit: fixing wrong parameter names in compute resource pref

Posted by ma...@apache.org.
fixing wrong parameter names in compute resource pref


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

Branch: refs/heads/dreg-gateway
Commit: 6f55b5b18dd38d39e5276b5b573c05790abf75b4
Parents: c4c63b7
Author: scnakandala <su...@gmail.com>
Authored: Tue Feb 7 14:02:22 2017 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Tue Feb 7 14:02:22 2017 -0500

----------------------------------------------------------------------
 app/views/partials/compute-resource-preferences.blade.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6f55b5b1/app/views/partials/compute-resource-preferences.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/compute-resource-preferences.blade.php b/app/views/partials/compute-resource-preferences.blade.php
index 86f0b3d..62a3a39 100644
--- a/app/views/partials/compute-resource-preferences.blade.php
+++ b/app/views/partials/compute-resource-preferences.blade.php
@@ -106,7 +106,7 @@
     <label class="control-label col-md-3">Gateway Id for Usage Reporting</label>
 
     <div class="col-md-9">
-        <input type="text" name="allocationProjectNumber" class="form-control"
+        <input type="text" name="usageReportingGatewayId" class="form-control"
                value="@if( isset( $preferences) ) {{$preferences->usageReportingGatewayId }}@endif"/>
         <small>Enter Id of the Gateway using this resource if it requires reporting its usage back to the resource.</small>
     </div>


[10/12] airavata-php-gateway git commit: Making sidebar sticky.

Posted by ma...@apache.org.
Making sidebar sticky.


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

Branch: refs/heads/dreg-gateway
Commit: db5eba49bec763e2aa49d19748f9169b98a72ada
Parents: dc971cb
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Sun Feb 12 16:27:52 2017 -0800
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Sun Feb 12 16:27:52 2017 -0800

----------------------------------------------------------------------
 app/views/layout/basic.blade.php             | 10 +++++++---
 app/views/partials/dashboard-block.blade.php |  6 ++----
 public/css/admin.css                         | 10 ++++++++--
 3 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/db5eba49/app/views/layout/basic.blade.php
----------------------------------------------------------------------
diff --git a/app/views/layout/basic.blade.php b/app/views/layout/basic.blade.php
index b621ecd..3e5e396 100755
--- a/app/views/layout/basic.blade.php
+++ b/app/views/layout/basic.blade.php
@@ -14,6 +14,9 @@ $title = Session::get("portal-title");
     position: relative;
     z-index:101;
 }
+.content-area{
+    margin: 20px 0;
+}
 </style>
 <div class="theme-header">
 <!-- Header from theme -->
@@ -92,12 +95,13 @@ var fullName = "{{Session::get("user-profile")["firstname"] . " " . Session::get
     //put sidebar below all headers in admin dashboards
     if( $(".side-nav").length > 0){
         var headerHeight = $(".pga-header").height() + $(".theme-header").height();
-        $(".side-nav").css("padding-top", headerHeight);
-
+        $(".side-nav").css("top", headerHeight);
+        $(".side-nav").affix();
         var selectedDashboardHeight = $(window).height() - headerHeight;
+        
         if( selectedDashboardHeight < $(".side-nav").height())
         {
-            $(".side-nav").height( selectedDashboardHeight).css("overflow-y", "scroll").css("overflow-x", "none");
+            $(".side-nav").height( selectedDashboardHeight);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/db5eba49/app/views/partials/dashboard-block.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/dashboard-block.blade.php b/app/views/partials/dashboard-block.blade.php
index d2b5220..8a07d78 100644
--- a/app/views/partials/dashboard-block.blade.php
+++ b/app/views/partials/dashboard-block.blade.php
@@ -1,7 +1,5 @@
-<div class="collapse navbar-collapse navbar-ex1-collapse">
-    <ul class="nav navbar-nav side-nav">
-
-
+<div class="collapse navbar-collapse navbar-ex1-collapse" >
+    <ul class="nav navbar-nav side-nav" data-spy="affix" >
         <li
             @if( Session::has("admin-nav") && Session::get("admin-nav") == "exp-statistics") class="active" @endif>
             <a class="dashboard-link"  href="{{ URL::to('/')}}/admin/dashboard/experiments">

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/db5eba49/public/css/admin.css
----------------------------------------------------------------------
diff --git a/public/css/admin.css b/public/css/admin.css
index 9d49c68..a1b18b4 100644
--- a/public/css/admin.css
+++ b/public/css/admin.css
@@ -116,12 +116,15 @@ ul.alert-dropdown {
     width: 200px;
 }
 
+.affix{
+    top:0;
+}
+
 /* Side Navigation */
 
 @media(min-width:768px) {
     .side-nav {
-        position: fixed;
-        top:0;
+        position:fixed;
         z-index: 100;
         left: 225px;
         width: 225px;
@@ -129,6 +132,9 @@ ul.alert-dropdown {
         border: none;
         border-radius: 0;
         background-color: #222;
+
+        overflow-y: auto;
+        overflow-x: none;
     }
 
     .side-nav>li>a {


[11/12] airavata-php-gateway git commit: Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/airavata-php-gateway into develop

Posted by ma...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/airavata-php-gateway into develop


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

Branch: refs/heads/dreg-gateway
Commit: f199d9b8b8c87117e6c8f457836167e20ab6b046
Parents: db5eba4 9765c1e
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Sun Feb 12 16:28:14 2017 -0800
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Sun Feb 12 16:28:14 2017 -0800

----------------------------------------------------------------------
 app/config/pga_config.php.template              |  8 +++
 app/controllers/AccountController.php           | 24 +++++--
 app/controllers/AdminController.php             | 65 ++++++++++--------
 app/controllers/ExperimentController.php        |  6 +-
 app/libraries/CommonUtilities.php               |  4 ++
 app/views/account/dashboard.blade.php           |  5 ++
 app/views/admin/manage-gateway.blade.php        | 70 +++++++++-----------
 .../compute-resource-preferences.blade.php      |  2 +-
 app/views/storage-resource/edit.blade.php       |  1 +
 9 files changed, 113 insertions(+), 72 deletions(-)
----------------------------------------------------------------------



[05/12] airavata-php-gateway git commit: AIRAVATA-2312 Removing unused method

Posted by ma...@apache.org.
AIRAVATA-2312 Removing unused method

AdminController::updateUserRoles isn't routed to or referenced internally


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

Branch: refs/heads/dreg-gateway
Commit: 773e542c47fbaa1db59739852c2d67717aea3bdd
Parents: 6f55b5b
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Feb 9 10:22:55 2017 -0500
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Feb 9 10:22:55 2017 -0500

----------------------------------------------------------------------
 app/controllers/AdminController.php | 15 ---------------
 1 file changed, 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/773e542c/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index d0aa3e5..1ecce03 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -278,21 +278,6 @@ class AdminController extends BaseController {
 		return View::make("admin/manage-credentials", array("tokens" => $tokens , "pwdTokens" => $pwdTokens) );
 	}
 
-	public function updateUserRoles(){
-		if( Input::has("add")){
-			WSIS::updateUserRoles(Input::get("username"), array("new"=> Input::get("roles"), "deleted" => array() ) );
-			$roles = WSIS::getUserRoles(Input::get("username"));
-			if(in_array(Config::get("pga_config.wsis")["admin-role-name"], $roles) || in_array(Config::get("pga_config.wsis")["read-only-admin-role-name"], $roles)
-				|| in_array(Config::get("pga_config.wsis")["user-role-name"], $roles)){
-				$userProfile = WSIS::getUserProfile(Input::get("username"));
-				$recipients = array($userProfile["email"]);
-				$this->sendAccessGrantedEmailToTheUser(Input::get("username"), $recipients);
-			}
-		}
-		else
-			return WSIS::updateUserRoles(Input::get("username"), array("new"=> array(), "deleted" => Input::get("roles") ) );
-	}
-
 	private function sendAccessGrantedEmailToTheUser($username, $recipients){
 
 		$mail = new PHPMailer;


[07/12] airavata-php-gateway git commit: http HEAD

Posted by ma...@apache.org.
http HEAD


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

Branch: refs/heads/dreg-gateway
Commit: 206e8d1f07762ccfa3158ebf74e1a727d4bc9826
Parents: ba4e574
Author: root <ro...@osboxes>
Authored: Fri Feb 10 04:51:46 2017 +0000
Committer: root <ro...@osboxes>
Committed: Fri Feb 10 04:51:46 2017 +0000

----------------------------------------------------------------------
 app/routes.php | 83 ++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 54 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/206e8d1f/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 955a77a..4189d13 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -171,10 +171,12 @@ Route::get("gbrowser/{filelist}", function($filelist){
     $folder_path=$filelist[0]. "ARCHIVE" ;
     $content = "[ \n";
     
+include("base32.php");
+
     for($i=1; $i<3; $i++){    
          $content = $content . ' {
          type:"bigwig",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode($filelist[$i*2]). '",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode($filelist[$i*2]). '",
          name: "'. $filelist[$i*2-1] .'",
          fixedscale:{min:0,max:20},
          colorpositive:"rgb(197,0,11)",
@@ -183,9 +185,9 @@ Route::get("gbrowser/{filelist}", function($filelist){
          },'. "\n" ;
     }
 
-    $content = $content . '{
-       type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode($folder_path . '/out.dREG.pred.gz').'",
+   $content = $content . '{
+      type:"bedgraph",
+        url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode($folder_path . '/out.dREG.pred.gz').'",
          name: "dREG informative pos.:",
          mode: "show",
          colorpositive:"#0000e5/#B30086",
@@ -196,7 +198,7 @@ Route::get("gbrowser/{filelist}", function($filelist){
 
     $content = $content . '{
        type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.peak.gz').'",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.peak.gz').'",
          name: "dREG Peak Calling:",
          mode: "show",
          colorpositive:"#0000e5/#B30086",
@@ -207,7 +209,7 @@ Route::get("gbrowser/{filelist}", function($filelist){
 
     $content = $content . '{
        type:"bigwig",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.imputedDnase.bw').'",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.imputedDnase.bw').'",
          name: "imputed DNase-I signal:",
          fixedscale:{min:0,max:20},
          colorpositive:"rgb(197,0,11)",
@@ -215,27 +217,27 @@ Route::get("gbrowser/{filelist}", function($filelist){
          mode: "show",
     },'. "\n";
 
-    $content = $content . '{
-       type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.relaxed.bed').'",
-         name: "dREG.HD relaxed peaks:",
-         mode: "show",
-         colorpositive:"#0000e5/#B30086",
-         backgroundcolor:"#ffffe5",
-         height:30,
-         fixedscale:{min:0, max:1},
-    },'. "\n";
-
-    $content = $content . '{
-       type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.stringent.bed').'",
-         name: "dREG.HD stringent peaks:",
-         mode: "show",
-         colorpositive:"#0000e5/#B30086",
-         backgroundcolor:"#ffffe5",
-         height:30,
-         fixedscale:{min:0, max:1},
-    },'. "\n";
+//    $content = $content . '{
+//       type:"bedgraph",
+//         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.relaxed.bed').'",
+//         name: "dREG.HD relaxed peaks:",
+//         mode: "show",
+//         colorpositive:"#0000e5/#B30086",
+//         backgroundcolor:"#ffffe5",
+//         height:30,
+//         fixedscale:{min:0, max:1},
+//    },'. "\n";
+
+//    $content = $content . '{
+//      type:"bedgraph",
+//         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.stringent.bed').'",
+//         name: "dREG.HD stringent peaks:",
+//         mode: "show",
+//         colorpositive:"#0000e5/#B30086",
+//         backgroundcolor:"#ffffe5",
+//         height:30,
+//         fixedscale:{min:0, max:1},
+//    },'. "\n";
 
 
     $content = $content . ']';
@@ -244,15 +246,38 @@ Route::get("gbrowser/{filelist}", function($filelist){
                   ->header('Content-Type', 'text/plain');
 });
 
+
 Route::get("gbfile/{file}", function($file){
-    $file = base64_decode( $file );
+    $filename = pathinfo($file, PATHINFO_FILENAME);
+    $fileext = pathinfo($file, PATHINFO_EXTENSION);
+include("base32.php");
+    if( $fileext != "")
+        $file = base32::decode( $filename ) .".".$fileext;
+    else
+        $file = base32::decode( $filename );
+
     if(0 === strpos($file, '/')){
         $file = substr($file, 1);
     }
+    
     $downloadLink = Config::get('pga_config.airavata')['experiment-data-absolute-path'] . '/' . $file;
-    return Response::download( $downloadLink);
+    if ( !file_exists($downloadLink) )
+        return Response::make('', 204);
+    else
+    {
+        if ($_SERVER["REQUEST_METHOD"]=="GET")
+        {
+           include 'libraries/PartialDownload.php';
+           return byteserve( $downloadLink);
+        } 
+        else	
+           return Response::make("", 200)
+                  ->header('Content-Length', filesize($downloadLink));
+    }
+
 });
 
+
 // dREG
 
 /*


[06/12] airavata-php-gateway git commit: AIRAVATA-2312 Adds 'initial-role-name' to pga_config.php

Posted by ma...@apache.org.
AIRAVATA-2312 Adds 'initial-role-name' to pga_config.php

'initial-role-name' defaults to 'user-pending' but can be customized to
automatically assign new users to the given role. The main use case for
this is to set 'initial-role-name' to 'gateway-user' to provide new
users access to the gateway without needing admin intervention.


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

Branch: refs/heads/dreg-gateway
Commit: 9765c1e250992c9ee870243081795e6aa2312948
Parents: 773e542
Author: Marcus Christie <ma...@iu.edu>
Authored: Thu Feb 9 11:17:49 2017 -0500
Committer: Marcus Christie <ma...@iu.edu>
Committed: Thu Feb 9 11:17:49 2017 -0500

----------------------------------------------------------------------
 app/config/pga_config.php.template    |  8 ++++++
 app/controllers/AccountController.php |  9 +++---
 app/controllers/AdminController.php   | 44 ++++++++++++++++++++++--------
 app/libraries/CommonUtilities.php     |  4 +++
 4 files changed, 50 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9765c1e2/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index ac378f6..8370364 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -24,6 +24,14 @@ return array(
         'user-role-name' => 'Internal/everyone',
 
         /**
+         * Initial user role. This is the initial user role assigned to a new
+         * user. Set this to one of the three roles above to automatically
+         * grant new users that role, or set to some other role ('user-pending')
+         * to require admin approval before users have access.
+         */
+        'initial-role-name' => 'user-pending',
+
+        /**
          * Tenant Domain
          */
         'tenant-domain' => 'master.airavata',

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9765c1e2/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 1490ee1..a9ac6b4 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -56,14 +56,15 @@ class AccountController extends BaseController
             WSIS::registerUserAccount($username, $password, $email, $first_name, $last_name, $organization, $address, $country, $telephone, $mobile, $im, $url,
                 Config::get('pga_config.wsis')['tenant-domain']);
 
-            /*add user to role - user-pending */
+            /*add user to the initial role */
 
+            $initialRoleName = CommonUtilities::getInitialRoleName();
             $allRoles = WSIS::getAllRoles();
-            if(! in_array( "user-pending", $allRoles)){
-                WSIS::addRole( "user-pending");
+            if(! in_array( $initialRoleName, $allRoles)){
+                WSIS::addRole( $initialRoleName);
             }
 
-            $userRoles["new"] = "user-pending";
+            $userRoles["new"] = $initialRoleName;
 
             if(  Config::get('pga_config.portal')['super-admin-portal'] == true ){
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9765c1e2/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 1ecce03..6dd27bd 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -236,22 +236,44 @@ class AdminController extends BaseController {
             $recipients = array($userProfile["email"]);
             $this->sendAccessGrantedEmailToTheUser(Input::get("username"), $recipients);
 
-            // remove the pending role when access is granted, unless
-            // the admin is trying to add the user to the pending role
-            if(in_array("user-pending", $newCurrentRoles) && !in_array("user-pending", $roles["new"])) {
-                $userRoles["new"] = array();
-                $userRoles["deleted"] = "user-pending";
-                WSIS::updateUserRoles( $username, $userRoles);
-            } else if(in_array("user-pending", $newCurrentRoles) && in_array("user-pending", $roles["new"])) {
-                // When user-pending role added remove all roles except for user-pending and Internal/everyone
-                $userRoles["new"] = array();
-                $userRoles["deleted"] = array_diff($newCurrentRoles, array("user-pending", "Internal/everyone"));
-                WSIS::updateUserRoles( $username, $userRoles);
+            // remove the initial role when the initial role isn't a privileged
+            // role and the admin has now assigned the user to a privileged
+            // role, unless the admin is trying to add the user back to the
+            // initial role
+            if (!$this->isInitialRoleOneOfPrivilegedRoles()) {
+
+                $initialRoleName = CommonUtilities::getInitialRoleName();
+                if(in_array($initialRoleName, $newCurrentRoles) && !in_array($initialRoleName, $roles["new"])) {
+                    $userRoles["new"] = array();
+                    $userRoles["deleted"] = $initialRoleName;
+                    WSIS::updateUserRoles( $username, $userRoles);
+                } else if(in_array($initialRoleName, $newCurrentRoles) && in_array($initialRoleName, $roles["new"])) {
+                    // When initial role added remove all roles except for initial role and Internal/everyone
+                    $userRoles["new"] = array();
+                    $userRoles["deleted"] = array_diff($newCurrentRoles, array($initialRoleName, "Internal/everyone"));
+                    WSIS::updateUserRoles( $username, $userRoles);
+                }
             }
         }
         return Redirect::to("admin/dashboard/roles")->with( "message", "Roles has been added.");
     }
 
+    /*
+     * Return true if the initial-role-name is one of the three privileged
+     * roles. This is used to figure out whether the initial-role-name is a
+     * 'user-pending' kind of role (returns false), or whether the initial role
+     * is a privileged role (returns true) and no admin intervention is
+     * necessary.
+     */
+    private function isInitialRoleOneOfPrivilegedRoles() {
+
+        $initialRoleName = CommonUtilities::getInitialRoleName();
+        $adminRoleName = Config::get("pga_config.wsis")["admin-role-name"];
+        $adminReadOnlyRoleName = Config::get("pga_config.wsis")["read-only-admin-role-name"];
+        $userRoleName = Config::get("pga_config.wsis")["user-role-name"];
+        return in_array($initialRoleName, array($adminRoleName, $adminReadOnlyRoleName, $userRoleName));
+    }
+
     public function removeRoleFromUser(){
         $roles["deleted"] = array(Input::all()["roleName"]);
         $roles["new"] = array();

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9765c1e2/app/libraries/CommonUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php
index 585016f..53f790e 100644
--- a/app/libraries/CommonUtilities.php
+++ b/app/libraries/CommonUtilities.php
@@ -438,5 +438,9 @@ class CommonUtilities
             return false;
         }
     }
+
+    public static function getInitialRoleName() {
+        return Config::get('pga_config.wsis.initial-role-name', 'user-pending');
+    }
 }
 


[03/12] airavata-php-gateway git commit: AIRAVATA-2266 : When tried to create tenant it asked to enter the auth key and the secret

Posted by ma...@apache.org.
AIRAVATA-2266 : When tried to create tenant it asked to enter the auth key and the secret


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

Branch: refs/heads/dreg-gateway
Commit: c4c63b78e4c57b7b80e4082083b25cd8e2395282
Parents: 4c47e54
Author: scnakandala <su...@gmail.com>
Authored: Mon Jan 30 13:51:02 2017 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Mon Jan 30 13:51:02 2017 -0500

----------------------------------------------------------------------
 app/views/admin/manage-gateway.blade.php | 70 ++++++++++++---------------
 1 file changed, 30 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/c4c63b78/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 099bec8..795af43 100644
--- a/app/views/admin/manage-gateway.blade.php
+++ b/app/views/admin/manage-gateway.blade.php
@@ -638,52 +638,42 @@
           dataObj[updateGatewayData[i].name] = updateGatewayData[i].value;
         }
 
-        if( updateVal == "createTenant" &&
-            ( $.trim( dataObj['oauthClientId'] ) == "" || $.trim( dataObj['oauthClientSecret'] ) == "") ){
-            $(".submit-actions").before("<div class='alert alert-danger fail-alert'>Tenant creation requires Oauth Client Id and Oauth Client Secret fields to be filled.</div>");
-            $(".loading-gif").remove();
 
-        }
-        else
-        {
-            $.ajax({
-                url: "{{URL::to('/')}}/admin/update-gateway-request",
-                method: "GET",
-                data: updateGatewayData
-            }).done( function( data){
-                $(".loading-gif").remove();
-                if( data == -1 ){
-                    //errors only with -1
-                    if( updateVal == "createTenant"){
-                    $(".submit-actions").before("<div class='alert alert-danger fail-alert'>Tenant creation has failed as Tenant with the same Domain name- airavata." + $(".gatewayAcronym").val() + " already exists in Identity Server. Please change Gateway Acronym and try again.");
-                    }
-                    else{
-                        $(".submit-actions").before("<div class='alert alert-danger fail-alert'>Error updating Gateway. Please try again.");
-                    }
+        $.ajax({
+            url: "{{URL::to('/')}}/admin/update-gateway-request",
+            method: "GET",
+            data: updateGatewayData
+        }).done( function( data){
+            $(".loading-gif").remove();
+            if( data == -1 ){
+                //errors only with -1
+                if( updateVal == "createTenant"){
+                $(".submit-actions").before("<div class='alert alert-danger fail-alert'>Tenant creation has failed as Tenant with the same Domain name- airavata." + $(".gatewayAcronym").val() + " already exists in Identity Server. Please change Gateway Acronym and try again.");
                 }
                 else{
-                    if( updateVal == "createTenant"){
-                        $(".submit-actions").before("<div class='alert alert-success success-alert'>Tenant has been created with domain name- airavata." + $(".gatewayAcronym").val());
-                        $(".notCreatedGateway").addClass("hide");
-
-                        $(".createdGateway").removeClass("hide");
+                    $(".submit-actions").before("<div class='alert alert-danger fail-alert'>Error updating Gateway. Please try again.");
+                }
+            }
+            else{
+                if( updateVal == "createTenant"){
+                    $(".submit-actions").before("<div class='alert alert-success success-alert'>Tenant has been created with domain name- airavata." + $(".gatewayAcronym").val());
+                    $(".notCreatedGateway").addClass("hide");
 
-                    }
-                    else{
-                        $(".submit-actions").before("<div class='alert alert-success success-alert'>Gateway has been updated successfully.");
-                    }
+                    $(".createdGateway").removeClass("hide");
 
-                    //refresh data next time if same popup is opened.
-                    var gatewayIdWithoutSpaces = dataObj['gateway_id'].replace(/\s+/g, '-');
-                    $("#view-" +  gatewayIdWithoutSpaces).data("gatewayobject", data);
-                    $("#view-" + gatewayIdWithoutSpaces ).parent().parent().find(".form-gatewayName").html( dataObj['gatewayName']);
-                    $("#view-" + gatewayIdWithoutSpaces ).parent().parent().find(".form-gatewayURL").html( dataObj['gatewayURL']);
                 }
-                //$(".onTenantComplete").removeClass("hide");
-                //$(".onTenantLoad").addClass("hide");
-                //$(".onTenantComplete").removeClass("hide");
-            });
-        }
+                else{
+                    $(".submit-actions").before("<div class='alert alert-success success-alert'>Gateway has been updated successfully.");
+                }
+
+                //refresh data next time if same popup is opened.
+                var gatewayIdWithoutSpaces = dataObj['gateway_id'].replace(/\s+/g, '-');
+                $("#view-" +  gatewayIdWithoutSpaces).data("gatewayobject", data);
+                $("#view-" + gatewayIdWithoutSpaces ).parent().parent().find(".form-gatewayName").html( dataObj['gatewayName']);
+                $("#view-" + gatewayIdWithoutSpaces ).parent().parent().find(".form-gatewayURL").html( dataObj['gatewayURL']);
+            }
+        });
+
     });
 
     $(".gaStatuses option[value=REQUESTED]").prop("selected", true);


[02/12] airavata-php-gateway git commit: fixing AIRAVATA-2267 : In view credential please show the domain.

Posted by ma...@apache.org.
fixing AIRAVATA-2267 : In view credential please show the domain.


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

Branch: refs/heads/dreg-gateway
Commit: 4c47e5408c6f83fbc9b6704750c860ae0af37bd6
Parents: f436e6a
Author: scnakandala <su...@gmail.com>
Authored: Mon Jan 30 11:15:01 2017 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Mon Jan 30 11:15:01 2017 -0500

----------------------------------------------------------------------
 app/views/account/dashboard.blade.php | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/4c47e540/app/views/account/dashboard.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/dashboard.blade.php b/app/views/account/dashboard.blade.php
index f23b40e..d59f78f 100644
--- a/app/views/account/dashboard.blade.php
+++ b/app/views/account/dashboard.blade.php
@@ -187,6 +187,10 @@
                             <td class="gateway-url"></td>
                         </tr>
                         <tr>
+                            <td>Gateway Domain</td>
+                            <td class="gateway-domain"></td>
+                        </tr>
+                        <tr>
                             <td>Admin Username</td>
                             <td class="admin-username"></td>
                         </tr>
@@ -491,6 +495,7 @@
         $(".admin-password").html( gatewayObject["identityServerPasswordToken"]);
         $(".gateway-id").html( gatewayObject["gatewayId"]);
         $(".gateway-url").html( gatewayObject["gatewayURL"]);
+        $(".gateway-domain").html( gatewayObject["domain"]);
         $(".oauth-client-key").html( gatewayObject["oauthClientId"]);
         $(".oauth-client-secret").html( gatewayObject["oauthClientSecret"]);
         $("#viewCredentials").modal("show");


[08/12] airavata-php-gateway git commit: Merge HEAD route

Posted by ma...@apache.org.
Merge HEAD route


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

Branch: refs/heads/dreg-gateway
Commit: 2c64ac007a96233abaa3b6ef1a30fba968a966e2
Parents: 206e8d1 0038011
Author: root <ro...@osboxes>
Authored: Fri Feb 10 04:54:19 2017 +0000
Committer: root <ro...@osboxes>
Committed: Fri Feb 10 04:54:19 2017 +0000

----------------------------------------------------------------------
 app/libraries/PartialDownload.php | 174 +++++++++++++++++++++++++++++++++
 app/routes.php                    |  63 ++++++------
 2 files changed, 206 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2c64ac00/app/routes.php
----------------------------------------------------------------------
diff --cc app/routes.php
index 4189d13,28f69d1..a9f40be
--- a/app/routes.php
+++ b/app/routes.php
@@@ -176,70 -174,75 +176,72 @@@ include("base32.php")
      for($i=1; $i<3; $i++){    
           $content = $content . ' {
           type:"bigwig",
 -         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode($filelist[$i*2]). '",
 +         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode($filelist[$i*2]). '",
           name: "'. $filelist[$i*2-1] .'",
           fixedscale:{min:0,max:20},
-          colorpositive:"rgb(197,0,11)",
-          height:50,
+          colorpositive:"#B30086",
+          colornegative:"#0000e5",
+          height:100,
           mode: "show",
           },'. "\n" ;
      }
  
 -    $content = $content . '{
 -       type:"bedgraph",
 -         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode($folder_path . '/out.dREG.pred.gz').'",
 +   $content = $content . '{
 +      type:"bedgraph",
 +        url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode($folder_path . '/out.dREG.pred.gz').'",
           name: "dREG informative pos.:",
           mode: "show",
-          colorpositive:"#0000e5/#B30086",
+          colorpositive:"#B30086",
+          colornegative:"#0000e5",
           backgroundcolor:"#ffffe5",
           height:30,
-          fixedscale:{min:0, max:1},
+          #fixedscale:{min:0, max:1},
      },'. "\n";
  
      $content = $content . '{
         type:"bedgraph",
 -         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.peak.gz').'",
 +         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.peak.gz').'",
           name: "dREG Peak Calling:",
           mode: "show",
-          colorpositive:"#0000e5/#B30086",
+          colorpositive:"#B30086",
+          colornegative:"#0000e5",
           backgroundcolor:"#ffffe5",
           height:30,
-          fixedscale:{min:0, max:1},
+          #fixedscale:{min:0, max:1},
      },'. "\n";
  
      $content = $content . '{
         type:"bigwig",
 -         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.imputedDnase.bw').'",
 +         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.imputedDnase.bw').'",
           name: "imputed DNase-I signal:",
-          fixedscale:{min:0,max:20},
-          colorpositive:"rgb(197,0,11)",
-          height:50,
+          #fixedscale:{min:0,max:20},
+          colorpositive:"#00B306",
+          height:100,
           mode: "show",
      },'. "\n";
  
- //    $content = $content . '{
- //       type:"bedgraph",
- //         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.relaxed.bed').'",
- //         name: "dREG.HD relaxed peaks:",
- //         mode: "show",
- //         colorpositive:"#0000e5/#B30086",
- //         backgroundcolor:"#ffffe5",
- //         height:30,
- //         fixedscale:{min:0, max:1},
- //    },'. "\n";
- 
- //    $content = $content . '{
- //      type:"bedgraph",
- //         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.stringent.bed').'",
- //         name: "dREG.HD stringent peaks:",
- //         mode: "show",
- //         colorpositive:"#0000e5/#B30086",
- //         backgroundcolor:"#ffffe5",
- //         height:30,
- //         fixedscale:{min:0, max:1},
- //    },'. "\n";
+     $content = $content . '{
+        type:"bedgraph",
 -         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.relaxed.bed').'",
++         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.relaxed.bed').'",
+          name: "dREG.HD relaxed peaks:",
+          mode: "show",
 -         colorpositive:"#B30086",
 -         colornegative:"#0000e5",
++         colorpositive:"#0000e5/#B30086",
+          backgroundcolor:"#ffffe5",
+          height:30,
+          fixedscale:{min:0, max:1},
+     },'. "\n";
  
+     $content = $content . '{
 -       type:"bedgraph",
 -         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.stringent.bed').'",
++      type:"bedgraph",
++         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.stringent.bed').'",
+          name: "dREG.HD stringent peaks:",
+          mode: "show",
 -         colorpositive:"#B30086",
 -         colornegative:"#0000e5",
++         colorpositive:"#0000e5/#B30086",
+          backgroundcolor:"#ffffe5",
+          height:30,
+          fixedscale:{min:0, max:1},
+     },'. "\n";
  
 -
      $content = $content . ']';
  
      return Response::make($content, 200)
@@@ -262,22 -263,14 +264,21 @@@ include("base32.php")
      
      $downloadLink = Config::get('pga_config.airavata')['experiment-data-absolute-path'] . '/' . $file;
      if ( !file_exists($downloadLink) )
 -        return Response::make('', 404);
 +        return Response::make('', 204);
      else
      {
 -        include 'libraries/PartialDownload.php';
 -        return byteserve( $downloadLink);
 +        if ($_SERVER["REQUEST_METHOD"]=="GET")
 +        {
 +           include 'libraries/PartialDownload.php';
 +           return byteserve( $downloadLink);
 +        } 
 +        else	
 +           return Response::make("", 200)
 +                  ->header('Content-Length', filesize($downloadLink));
      }
- 
  });
  
 +
  // dREG
  
  /*


[09/12] airavata-php-gateway git commit: modification for file download from genome browser

Posted by ma...@apache.org.
modification for file download  from genome browser


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

Branch: refs/heads/dreg-gateway
Commit: d5533b068720e5ea1770ab16811539cfd8106ad9
Parents: 2c64ac0
Author: root <ro...@osboxes>
Authored: Sat Feb 11 04:53:36 2017 +0000
Committer: root <ro...@osboxes>
Committed: Sat Feb 11 04:53:36 2017 +0000

----------------------------------------------------------------------
 app/libraries/PartialDownload.php | 174 ---------------------------------
 app/libraries/basecode.php        |  98 +++++++++++++++++++
 app/routes.php                    |  40 ++++----
 3 files changed, 118 insertions(+), 194 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d5533b06/app/libraries/PartialDownload.php
----------------------------------------------------------------------
diff --git a/app/libraries/PartialDownload.php b/app/libraries/PartialDownload.php
deleted file mode 100644
index eb10775..0000000
--- a/app/libraries/PartialDownload.php
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php 
-/*
-
-The following byte serving code is (C) 2004 Razvan Florian. You may find the latest version at 
-http://www.coneural.org/florian/papers/04_byteserving.php
-
-*/
-function set_range($range, $filesize, &$first, &$last){
-  /*
-  Sets the first and last bytes of a range, given a range expressed as a string 
-  and the size of the file.
-
-  If the end of the range is not specified, or the end of the range is greater 
-  than the length of the file, $last is set as the end of the file.
-
-  If the begining of the range is not specified, the meaning of the value after 
-  the dash is "get the last n bytes of the file".
-
-  If $first is greater than $last, the range is not satisfiable, and we should 
-  return a response with a status of 416 (Requested range not satisfiable).
-
-  Examples:
-  $range='0-499', $filesize=1000 => $first=0, $last=499 .
-  $range='500-', $filesize=1000 => $first=500, $last=999 .
-  $range='500-1200', $filesize=1000 => $first=500, $last=999 .
-  $range='-200', $filesize=1000 => $first=800, $last=999 .
-
-  */
-  $dash=strpos($range,'-');
-  $first=trim(substr($range,0,$dash));
-  $last=trim(substr($range,$dash+1));
-  if ($first=='') {
-    //suffix byte range: gets last n bytes
-    $suffix=$last;
-    $last=$filesize-1;
-    $first=$filesize-$suffix;
-    if($first<0) $first=0;
-  } else {
-    if ($last=='' || $last>$filesize-1) $last=$filesize-1;
-  }
-  if($first>$last){
-    //unsatisfiable range
-    header("Status: 416 Requested range not satisfiable");
-    header("Content-Range: */$filesize");
-    exit;
-  }
-}
-
-function buffered_read($file, $bytes, $buffer_size=1024){
-  /*
-  Outputs up to $bytes from the file $file to standard output, $buffer_size bytes at a time.
-  */
-  $bytes_left=$bytes;
-  while($bytes_left>0 && !feof($file)){
-    if($bytes_left>$buffer_size)
-      $bytes_to_read=$buffer_size;
-    else
-      $bytes_to_read=$bytes_left;
-    $bytes_left-=$bytes_to_read;
-    $contents=fread($file, $bytes_to_read);
-    echo $contents;
-    flush();
-  }
-}
-
-function byteserve($filename){
-  /*
-  Byteserves the file $filename.  
-
-  When there is a request for a single range, the content is transmitted 
-  with a Content-Range header, and a Content-Length header showing the number 
-  of bytes actually transferred.
-
-  When there is a request for multiple ranges, these are transmitted as a 
-  multipart message. The multipart media type used for this purpose is 
-  "multipart/byteranges".
-  */
-
-  $fileext = strtoupper( pathinfo($filename, PATHINFO_EXTENSION) );
-  $filesize=filesize($filename);
-  $file=fopen($filename,"rb");
-
-  $ranges=NULL;
-  if ($_SERVER['REQUEST_METHOD']=='GET' && isset($_SERVER['HTTP_RANGE']) && $range=stristr(trim($_SERVER['HTTP_RANGE']),'bytes=')){
-    $range=substr($range,6);
-    $boundary='g45d64df96bmdf4sdgh45hf5';//set a random boundary
-    $ranges=explode(',',$range);
-  }
-
-  if($ranges && count($ranges)){
-    header("HTTP/1.1 206 Partial content");
-    header("Accept-Ranges: bytes");
-    if(count($ranges)>1){
-      /*
-      More than one range is requested. 
-      */
-
-      //compute content length
-      $content_length=0;
-      foreach ($ranges as $range){
-        set_range($range, $filesize, $first, $last);
-        $content_length+=strlen("\r\n--$boundary\r\n");
-if ($fileext=="PDF")
-        $content_length+=strlen("Content-type: application/pdf\r\n");
-else
-        $content_length+=strlen("Content-type: application/octet-stream\r\n");
-        $content_length+=strlen("Content-range: bytes $first-$last/$filesize\r\n\r\n");
-        $content_length+=$last-$first+1;          
-      }
-      $content_length+=strlen("\r\n--$boundary--\r\n");
-
-      //output headers
-      header("Content-Length: $content_length");
-      //see http://httpd.apache.org/docs/misc/known_client_problems.html for an discussion of x-byteranges vs. byteranges
-      header("Content-Type: multipart/x-byteranges; boundary=$boundary");
-
-      //output the content
-      foreach ($ranges as $range){
-        set_range($range, $filesize, $first, $last);
-        echo "\r\n--$boundary\r\n";
-if ($fileext=="PDF")
-        echo "Content-type: application/pdf\r\n";
-else
-        echo "Content-type: application/octet-stream\r\n";
-        echo "Content-range: bytes $first-$last/$filesize\r\n\r\n";
-        fseek($file,$first);
-        buffered_read ($file, $last-$first+1);          
-      }
-      echo "\r\n--$boundary--\r\n";
-    } else {
-      /*
-      A single range is requested.
-      */
-      $range=$ranges[0];
-      set_range($range, $filesize, $first, $last);  
-      header("Content-Length: ".($last-$first+1) );
-      header("Content-Range: bytes $first-$last/$filesize");
-if ($fileext=="PDF")
-      header("Content-Type: application/pdf");  
-else
-      header("Content-Type: application/octet-stream");  
-      fseek($file,$first);
-      buffered_read($file, $last-$first+1);
-    }
-  } else{
-    //no byteserving
-    header("Accept-Ranges: bytes");
-    header("Content-Length: $filesize");
-if ($fileext=="PDF")
-    header("Content-Type: application/pdf");  
-else
-    header("Content-Type: application/octet-stream");
-    readfile($filename);
-  }
-  fclose($file);
-}
-
-function serve($filename, $download=0){
-  //Just serves the file without byteserving
-  //if $download=true, then the save file dialog appears
-  $filesize=filesize($filename);
-  header("Content-Length: $filesize");
-  header("Content-Type: application/octet-stream");
-  $filename_parts=pathinfo($filename);
-  if($download) header('Content-disposition: attachment; filename='.$filename_parts['basename']);
-  readfile($filename);
-}
-
-//unset magic quotes; otherwise, file contents will be modified
-//set_magic_quotes_runtime(0);
-
-//do not send cache limiter header
-//ini_set('session.cache_limiter','none');
-

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d5533b06/app/libraries/basecode.php
----------------------------------------------------------------------
diff --git a/app/libraries/basecode.php b/app/libraries/basecode.php
new file mode 100644
index 0000000..bab9fd2
--- /dev/null
+++ b/app/libraries/basecode.php
@@ -0,0 +1,98 @@
+<?php
+class Base32
+{
+	const BITS_5_RIGHT = 31;
+	protected static $CHARS = '0123456789abcdefghijklmnopqrstuv';
+	
+	public static function encode($data)
+	{
+		$dataSize = strlen($data);
+		$res = '';
+		$remainder = 0;
+		$remainderSize = 0;
+		
+		for ($i = 0; $i < $dataSize; $i++)
+		{
+			$b = ord($data[$i]);
+			$remainder = ($remainder << 8) | $b;
+			$remainderSize += 8;
+			while ($remainderSize > 4)
+			{
+				$remainderSize -= 5;
+				$c = $remainder & (self::BITS_5_RIGHT << $remainderSize);
+				$c >>= $remainderSize;
+				$res .= self::$CHARS[$c];
+			}
+		}
+		if ($remainderSize > 0)
+		{
+			// remainderSize < 5:
+			$remainder <<= (5 - $remainderSize);
+			$c = $remainder & self::BITS_5_RIGHT;
+			$res .= self::$CHARS[$c];
+		}
+		
+		return $res;
+	}
+	
+	public static function decode($data)
+	{
+		$data = strtolower($data);
+		$dataSize = strlen($data);
+		$buf = 0;
+		$bufSize = 0;
+		$res = '';
+		
+		for ($i = 0; $i < $dataSize; $i++)
+		{
+			$c = $data[$i];
+			$b = strpos(self::$CHARS, $c);
+			if ($b === false)
+				throw new Exception('Encoded string is invalid, it contains unknown char #'.ord($c));
+			$buf = ($buf << 5) | $b;
+			$bufSize += 5;
+			if ($bufSize > 7)
+			{
+				$bufSize -= 8;
+				$b = ($buf & (0xff << $bufSize)) >> $bufSize;
+				$res .= chr($b);
+			}
+		}
+		
+		return $res;
+	}
+}
+
+function rbase64_encode($string){
+    $string = base64_encode($string);
+    $reversed_string="";
+    $string_length = strlen($string);
+
+    for($i=$string_length-1;$i>-1;$i--)
+    {
+        if ($string[$i]==='=')
+           $reversed_string .= '_';
+        else
+           $reversed_string .= $string[$i];
+    }
+    return $reversed_string;
+}
+
+
+function rbase64_decode($rstring){
+    $string="";
+    $string_length = strlen($rstring);
+
+    for($i=$string_length-1;$i>-1;$i--)
+    {
+        if ($rstring[$i]==='_')
+           $string .= '=';
+        else
+           $string .= $rstring[$i];
+    }
+
+    return base64_decode($string);
+}
+
+
+?>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d5533b06/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index a9f40be..81e1ca5 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -171,14 +171,14 @@ Route::get("gbrowser/{filelist}", function($filelist){
     $folder_path=$filelist[0]. "ARCHIVE" ;
     $content = "[ \n";
     
-include("base32.php");
-
+    include("libraries/basecode.php");
+ 
     for($i=1; $i<3; $i++){    
          $content = $content . ' {
          type:"bigwig",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode($filelist[$i*2]). '",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.rbase64_encode($filelist[$i*2]). '",
          name: "'. $filelist[$i*2-1] .'",
-         fixedscale:{min:0,max:20},
+         #fixedscale:{min:0,max:20},
          colorpositive:"#B30086",
          colornegative:"#0000e5",
          height:100,
@@ -186,9 +186,10 @@ include("base32.php");
          },'. "\n" ;
     }
 
-   $content = $content . '{
+
+  $content = $content . '{
       type:"bedgraph",
-        url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode($folder_path . '/out.dREG.pred.gz').'",
+        url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.rbase64_encode($folder_path . '/out.dREG.pred.gz').'",
          name: "dREG informative pos.:",
          mode: "show",
          colorpositive:"#B30086",
@@ -198,9 +199,9 @@ include("base32.php");
          #fixedscale:{min:0, max:1},
     },'. "\n";
 
-    $content = $content . '{
+   $content = $content . '{
        type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.peak.gz').'",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.rbase64_encode( $folder_path . '/out.dREG.peak.gz').'",
          name: "dREG Peak Calling:",
          mode: "show",
          colorpositive:"#B30086",
@@ -210,9 +211,9 @@ include("base32.php");
          #fixedscale:{min:0, max:1},
     },'. "\n";
 
-    $content = $content . '{
+   $content = $content . '{
        type:"bigwig",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.imputedDnase.bw').'",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.rbase64_encode( $folder_path . '/out.dREG.HD.imputedDnase.bw').'",
          name: "imputed DNase-I signal:",
          #fixedscale:{min:0,max:20},
          colorpositive:"#00B306",
@@ -222,7 +223,7 @@ include("base32.php");
 
     $content = $content . '{
        type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.relaxed.bed').'",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.rbase64_encode( $folder_path . '/out.dREG.HD.relaxed.bed.gz').'",
          name: "dREG.HD relaxed peaks:",
          mode: "show",
          colorpositive:"#0000e5/#B30086",
@@ -233,7 +234,7 @@ include("base32.php");
 
     $content = $content . '{
       type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base32::encode( $folder_path . '/out.dREG.HD.stringent.bed').'",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.rbase64_encode( $folder_path . '/out.dREG.HD.stringent.bed.gz').'",
          name: "dREG.HD stringent peaks:",
          mode: "show",
          colorpositive:"#0000e5/#B30086",
@@ -252,26 +253,25 @@ include("base32.php");
 Route::get("gbfile/{file}", function($file){
     $filename = pathinfo($file, PATHINFO_FILENAME);
     $fileext = pathinfo($file, PATHINFO_EXTENSION);
-include("base32.php");
+
+    include("libraries/basecode.php");
     if( $fileext != "")
-        $file = base32::decode( $filename ) .".".$fileext;
+        $file = rbase64_decode( $filename ) .".".$fileext;
     else
-        $file = base32::decode( $filename );
+        $file = rbase64_decode( $filename );
 
     if(0 === strpos($file, '/')){
         $file = substr($file, 1);
     }
     
     $downloadLink = Config::get('pga_config.airavata')['experiment-data-absolute-path'] . '/' . $file;
+
     if ( !file_exists($downloadLink) )
-        return Response::make('', 204);
+        return Response::make("", 204);
     else
     {
         if ($_SERVER["REQUEST_METHOD"]=="GET")
-        {
-           include 'libraries/PartialDownload.php';
-           return byteserve( $downloadLink);
-        } 
+              return Response::download($downloadLink);
         else	
            return Response::make("", 200)
                   ->header('Content-Length', filesize($downloadLink));


[12/12] airavata-php-gateway git commit: Merge remote-tracking branch 'origin/develop' into dreg-gateway

Posted by ma...@apache.org.
Merge remote-tracking branch 'origin/develop' into dreg-gateway


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

Branch: refs/heads/dreg-gateway
Commit: 75929d7798e5a1bc2ff820d03b1ce85175408f8c
Parents: d5533b0 f199d9b
Author: Marcus Christie <ma...@iu.edu>
Authored: Wed Feb 15 09:36:06 2017 -0500
Committer: Marcus Christie <ma...@iu.edu>
Committed: Wed Feb 15 09:36:06 2017 -0500

----------------------------------------------------------------------
 app/config/pga_config.php.template              |  8 +++
 app/controllers/AccountController.php           |  9 +--
 app/controllers/AdminController.php             | 65 ++++++++++--------
 app/libraries/CommonUtilities.php               |  4 ++
 app/views/account/dashboard.blade.php           |  5 ++
 app/views/admin/manage-gateway.blade.php        | 70 +++++++++-----------
 app/views/layout/basic.blade.php                | 10 ++-
 .../compute-resource-preferences.blade.php      |  2 +-
 app/views/partials/dashboard-block.blade.php    |  6 +-
 public/css/admin.css                            | 10 ++-
 10 files changed, 109 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/75929d77/app/libraries/CommonUtilities.php
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/75929d77/app/views/account/dashboard.blade.php
----------------------------------------------------------------------