airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [2/7] airavata-php-gateway git commit: mix project permissions with experiment
Date Thu, 14 Jul 2016 21:50:28 GMT
mix project permissions with experiment


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

Branch: refs/heads/grouper-integration
Commit: 3e844942d149bd352ee4053aee4b9d6a0a3dac1d
Parents: 52019b9
Author: Jeff Kinnison <jeffdkinnison@gmail.com>
Authored: Thu Jul 14 16:04:21 2016 -0400
Committer: Jeff Kinnison <jeffdkinnison@gmail.com>
Committed: Thu Jul 14 16:04:21 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php       |  7 +++++--
 app/libraries/SharingUtilities.php             | 13 +++++++++++++
 app/views/group/browse.blade.php               |  0
 app/views/partials/experiment-inputs.blade.php |  8 ++++----
 4 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3e844942/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 5f1edb2..677aa0e 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -41,6 +41,7 @@ class ExperimentController extends BaseController
                 "wallTimeLimit" => Config::get('pga_config.airavata')["wall-time-limit"]
             );
 
+
             $clonedExp = false; $savedExp = false;
             if( Input::has("clonedExp"))
                 $clonedExp = true;
@@ -72,7 +73,7 @@ class ExperimentController extends BaseController
                 "allowedFileSize" => $allowedFileSize
             );
 
-            $users = SharingUtilities::getAllUserProfiles();
+            $users = SharingUtilities::mixProjectPermissionsWithExperiment($_POST['project']);
 
             return View::make("experiment/create-complete", array("expInputs" => $experimentInputs,
"users" => json_encode($users)));
         } else if (isset($_POST['save']) || isset($_POST['launch'])) {
@@ -235,7 +236,7 @@ class ExperimentController extends BaseController
             'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"]
         );
 
-        $users = SharingUtilities::getAllUserProfiles($_GET['expId'], ResourceType::EXPERIMENT);
+        $users = SharingUtilities::mixProjectPermissionsWithExperiment($experiment->project,
$_GET['expId']);
 
         return View::make("experiment/edit", array("expInputs" => $experimentInputs, "users"
=> json_encode($users)));
     }
@@ -243,7 +244,9 @@ class ExperimentController extends BaseController
     public function cloneExperiment()
     {
         if (isset($_GET['expId'])) {
+            $users = getAllUserPermissions($_GET['expId'], ResourceType::EXPERIMENT);
             $cloneId = ExperimentUtilities::clone_experiment($_GET['expId']);
+            ExperimentUtilities::share_experiment($cloneId, $users);
             $experiment = ExperimentUtilities::get_experiment($cloneId);
             $project = ProjectUtilities::get_project($experiment->projectId);
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3e844942/app/libraries/SharingUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/SharingUtilities.php b/app/libraries/SharingUtilities.php
index cba9bd5..027355b 100644
--- a/app/libraries/SharingUtilities.php
+++ b/app/libraries/SharingUtilities.php
@@ -138,6 +138,19 @@ class SharingUtilities {
         }
         return $profs;
     }
+
+    public static function mixProjectPermissionsWithExperiment($projectId, $expId=null) {
+        $proj = SharingUtilities::getProfilesForSharedUsers($projectId, ResourceType::PROJECT);
+        $exp = SharingUtilities::getAllUserProfiles($expId, ResourceType::EXPERIMENT);
+
+        foreach ($proj as $uid => $prof) {
+            if (!array_key_exists($uid, $exp)) {
+                $exp[$uid] = $prof;
+            }
+        }
+
+        return $exp;
+    }
 }
 
 ?>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3e844942/app/views/group/browse.blade.php
----------------------------------------------------------------------
diff --git a/app/views/group/browse.blade.php b/app/views/group/browse.blade.php
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3e844942/app/views/partials/experiment-inputs.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-inputs.blade.php b/app/views/partials/experiment-inputs.blade.php
index 09a546c..2a67b96 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -14,11 +14,11 @@
 </div>
 <div class="form-group required">
     <label for="project" class="control-label">Project</label>
-    @if( $expInputs["clonedExp"] || $expInputs["savedExp"])
+    {{-- @if( $expInputs["clonedExp"] || $expInputs["savedExp"]) --}}
         {{ ProjectUtilities::create_project_select($expInputs["project"], false) }}
-    @else
-        {{ ProjectUtilities::create_project_select($expInputs["project"], true) }}
-    @endif
+    {{-- @else --}}
+        {{-- {{ ProjectUtilities::create_project_select($expInputs["project"], true) }} --}}
+    {{-- @endif --}}
 </div>
 <div class="form-group">
     <label for="application">Application</label>


Mime
View raw message