AIRAVATA-2345 Including OWNER in array of users with permissions

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

Branch: refs/heads/dreg-gateway
Commit: 3c12fea14ce75fe19f4b566e67b4c2b714a16697
Parents: aba44b6
Author: Marcus Christie <[email protected]>
Authored: Fri Mar 24 10:13:34 2017 -0400
Committer: Marcus Christie <[email protected]>
Committed: Fri Mar 24 10:13:34 2017 -0400

----------------------------------------------------------------------
 app/libraries/SharingUtilities.php | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c12fea1/app/libraries/SharingUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/SharingUtilities.php 
b/app/libraries/SharingUtilities.php
index b689b24..fb2fb84 100755
--- a/app/libraries/SharingUtilities.php
+++ b/app/libraries/SharingUtilities.php
@@ -57,13 +57,14 @@ class SharingUtilities {
      *
      * @param $resourceId           Experiment or Project ID
      * @param $dataResourceType     e.g 
Airavata\Model\Group\ResourceType:PROJECT,Airavata\Model\Group\ResourceType:EXPERIMENT
-     * @return An array [$uid => [read => bool, write => bool]]
+     * @return An array [$uid => [read => bool, write => bool, owner => bool]]
      */
     public static function getAllUserPermissions($resourceId, 
$dataResourceType) {
         $users = array();
 
         $read = GrouperUtilities::getAllAccessibleUsers($resourceId, 
$dataResourceType, ResourcePermissionType::READ);
         $write = GrouperUtilities::getAllAccessibleUsers($resourceId, 
$dataResourceType, ResourcePermissionType::WRITE);
+        $owner = GrouperUtilities::getAllAccessibleUsers($resourceId, 
$dataResourceType, ResourcePermissionType::OWNER);
 
         foreach($read as $uid) {
             if ($uid !== Session::get('username') && 
WSIS::usernameExists($uid)) {
@@ -77,6 +78,12 @@ class SharingUtilities {
             }
         }
 
+        foreach($owner as $uid) {
+            if ($uid !== Session::get('username') && 
WSIS::usernameExists($uid)) {
+                $users[$uid]['owner'] = true;
+            }
+        }
+
         return $users;
     }
 
@@ -138,7 +145,7 @@ class SharingUtilities {
      *
      * @param $resourceId           Experiment or Project ID
      * @param $dataResourceType     e.g 
Airavata\Model\Group\ResourceType:PROJECT,Airavata\Model\Group\ResourceType:EXPERIMENT
-     * @return An array [uid => [firstname => string, lastname => string, 
email => string, access => [read => bool, write => bool]]]
+     * @return An array [uid => [firstname => string, lastname => string, 
email => string, access => [read => bool, write => bool, owner => bool]]]
      *         with access only defined for users with permissions.
      */
     public static function getAllUserProfiles($resourceId=null, 
$dataResourceType=null) {

Reply via email to