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

[02/20] airavata-php-gateway git commit: updated controllers to only load shared users, added functions to retrieve user lists as JSON

updated controllers to only load shared users, added functions to retrieve user lists as JSON


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

Branch: refs/heads/develop
Commit: 4f5f026913eff3760054a943ef9ba781a2fbc557
Parents: 3c07153
Author: Jeff Kinnison <je...@gmail.com>
Authored: Thu Aug 4 12:22:12 2016 -0400
Committer: Jeff Kinnison <je...@gmail.com>
Committed: Thu Aug 4 12:22:12 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php | 33 ++++++++++++++++++++++++---
 app/controllers/ProjectController.php    |  9 ++++----
 2 files changed, 34 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/4f5f0269/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 499327d..ada4824 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -73,7 +73,7 @@ class ExperimentController extends BaseController
                 "allowedFileSize" => $allowedFileSize
             );
 
-            $users = SharingUtilities::getAllUserProfiles($_POST['project'], ResourceType::PROJECT);
+            $users = SharingUtilities::getProfilesForSharedUsers($_POST['project'], ResourceType::PROJECT);
 
             return View::make("experiment/create-complete", array("expInputs" => $experimentInputs, "users" => json_encode($users)));
         } else if (isset($_POST['save']) || isset($_POST['launch'])) {
@@ -90,7 +90,7 @@ class ExperimentController extends BaseController
                     <a href=' . URL::to('/') . '"/experiment/summary?expId=' . $expId . '">go directly</a> to experiment summary page.</p>');
 
             }*/
-            $users = SharingUtilities::getAllUserProfiles($expId, ResourceType::EXPERIMENT);
+            $users = SharingUtilities::getProfilesForSharedUsers($expId, ResourceType::EXPERIMENT);
             return Redirect::to('experiment/summary?expId=' . $expId);
         } else
             return Redirect::to("home")->with("message", "Something went wrong here. Please file a bug report using the link in the Help menu.");
@@ -237,7 +237,7 @@ class ExperimentController extends BaseController
             'advancedOptions' => Config::get('pga_config.airavata')["advanced-experiment-options"]
         );
 
-        $users = SharingUtilities::getAllUserProfiles($_GET['expId'], ResourceType::EXPERIMENT);
+        $users = SharingUtilities::getProfilesForSharedUsers($_GET['expId'], ResourceType::EXPERIMENT);
 
         return View::make("experiment/edit", array("expInputs" => $experimentInputs, "users" => json_encode($users)));
     }
@@ -313,6 +313,33 @@ class ExperimentController extends BaseController
             'expContainer' => $expContainer
         ));
     }
+
+    /**
+     * Generate JSON containing permissions information for this project.
+     *
+     * This function retrieves the user profile and permissions for every user
+     * other than the client that has access to the project. In the event that
+     * the project does not exist, return an error message.
+     */
+    public function sharedUsers()
+    {
+        if (array_key_exists('projId', $_POST)) {
+            return Response::json(SharingUtilities::getProfilesForSharedUsers());
+        }
+        else {
+            return Response::json(array("error" => "Error: No project specified"));
+        }
+    }
+
+    public function unsharedUsers()
+    {
+        if (array_key_exists('projId', $_POST)) {
+            return Response::json(SharingUtilities::getProfilesForUnsharedUsers());
+        }
+        else {
+            return Response::json(array("error" => "Error: No project specified"));
+        }
+    }
 }
 
 ?>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/4f5f0269/app/controllers/ProjectController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ProjectController.php b/app/controllers/ProjectController.php
index 6b874f2..c98f35e 100755
--- a/app/controllers/ProjectController.php
+++ b/app/controllers/ProjectController.php
@@ -25,7 +25,7 @@ class ProjectController extends BaseController
 
     public function createView()
     {
-        $users = SharingUtilities::getAllUserProfiles();
+        $users = array();
         //var_dump($users);exit;
         return View::make("project/create", array("users" => json_encode($users)));
     }
@@ -120,8 +120,7 @@ class ProjectController extends BaseController
      */
     public function sharedUsers()
     {
-        $response = array();
-        if (Input::has('projId')) {
+        if (array_key_exists('expId', $_POST)) {
             return Response::json(SharingUtilities::getProfilesForSharedUsers());
         }
         else {
@@ -131,8 +130,8 @@ class ProjectController extends BaseController
 
     public function unsharedUsers()
     {
-        if (Input::has('projId')) {
-            return Response::json(SharingUtilities::getProfilesForUnsharedUsers);
+        if (array_key_exists('expId', $_POST)) {
+            return Response::json(SharingUtilities::getProfilesForUnsharedUsers());
         }
         else {
             return Response::json(array("error" => "Error: No project specified"));