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:55 UTC

[08/20] airavata-php-gateway git commit: fixed issue 2005, 2014, 2021

fixed issue 2005, 2014, 2021


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

Branch: refs/heads/develop
Commit: 98b6ca3c064aff4a730495a410606d1c5760ecd7
Parents: bb852b7
Author: Jeff Kinnison <je...@gmail.com>
Authored: Mon Aug 15 12:09:33 2016 -0400
Committer: Jeff Kinnison <je...@gmail.com>
Committed: Mon Aug 15 12:09:33 2016 -0400

----------------------------------------------------------------------
 app/controllers/ExperimentController.php |  4 ++--
 app/libraries/ExperimentUtilities.php    |  8 +++-----
 app/libraries/SharingUtilities.php       | 14 ++++++++------
 public/js/sharing/share.js               |  6 +++---
 4 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/98b6ca3c/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 0b48605..defe700 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -333,11 +333,11 @@ class ExperimentController extends BaseController
 
     public function unsharedUsers()
     {
-        if (array_key_exists('resourceId', $_POST)) {
+        if (array_key_exists('resourceId', $_GET)) {
             return Response::json(SharingUtilities::getProfilesForUnsharedUsers($_GET['resourceId'], ResourceType::EXPERIMENT));
         }
         else {
-            return Response::json(array("error" => "Error: No project specified"));
+            return Response::json(array("error" => "Error: No experiment specified"));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/98b6ca3c/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index e5da839..b22b8be 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -634,10 +634,8 @@ class ExperimentUtilities
             Airavata::updateExperiment(Session::get('authz-token'), $cloneId, $experiment);
 
             $share = SharingUtilities::getAllUserPermissions($expId, ResourceType::EXPERIMENT);
-            $share->{Session::get('username')} = new stdClass();
-            $share->{Session::get('username')}->read = true;
-            $share->{Session::get('username')}->write = true;
-            ExperimentUtilities::share_experiment($cloneId, $share);
+            $share[Session::get('username')] = ["read" => true, "write" => true];
+            ExperimentUtilities::share_experiment($cloneId, json_decode(json_encode($share)));
 
             return $cloneId;
         } catch (InvalidRequestException $ire) {
@@ -1131,7 +1129,7 @@ class ExperimentUtilities
         $expContainer = array();
         $expNum = 0;
         foreach ($experiments as $experiment) {
-            if (SharingUtilities::userCanRead(Session::get('username'), $experiment, ResourceType::EXPERIMENT)) {
+            if (SharingUtilities::userCanRead(Session::get('username'), $experiment->experimentId, ResourceType::EXPERIMENT)) {
                 $expValue = ExperimentUtilities::get_experiment_values($experiment, true);
                 $expContainer[$expNum]['experiment'] = $experiment;
                 if ($expValue["experimentStatusString"] == "FAILED")

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/98b6ca3c/app/libraries/SharingUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/SharingUtilities.php b/app/libraries/SharingUtilities.php
old mode 100644
new mode 100755
index 7b98f97..bf9987f
--- a/app/libraries/SharingUtilities.php
+++ b/app/libraries/SharingUtilities.php
@@ -25,12 +25,14 @@ class SharingUtilities {
      * @return True if the user has read permission, false otherwise.
      */
     public static function userCanRead($uid, $resourceId, $dataResourceType) {
-        if (WSIS::usernameExists($uid)) {
-            $read = GrouperUtilities::getAllAccessibleUsers($resourceId, $dataResourceType, ResourcePermissionType::READ);
-            return (array_key_exists($uid, $read) ? true : false);
-        }
-        else {
-            return false;
+        $read = GrouperUtilities::getAllAccessibleUsers($resourceId, $dataResourceType, ResourcePermissionType::READ);
+        foreach($read as $user) {
+            if (strcmp($uid, $user) === 0) {
+                return true;
+            }
+            else {
+                return false;
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/98b6ca3c/public/js/sharing/share.js
----------------------------------------------------------------------
diff --git a/public/js/sharing/share.js b/public/js/sharing/share.js
index ee4885e..5171b02 100755
--- a/public/js/sharing/share.js
+++ b/public/js/sharing/share.js
@@ -110,11 +110,11 @@ $(function() {
                     var user, $user, $users;
 
                     $users = $('#share-box-users');
-                    $users.empty().removeClass('text-align-center');
-                    console.log(data);
+                    $users.removeClass('text-align-center');
+                    $users.text('');
                     for (user in data) {
                         if (data.hasOwnProperty(user)) {
-                            $user = createThumbnail(user, data.firstname, data.lastname, data.email, access_enum.NONE, true);
+                            $user = createThumbnail(user, data[user].firstname, data[user].lastname, data[user].email, access_enum.NONE, true);
                             $user.find('.sharing-thumbnail-access').hide();
 
                             $user.addClass('user-thumbnail');