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 2018/06/06 16:30:15 UTC
[airavata-php-gateway] 03/03: AIRAVATA-2781 Using userHasAccess to
test migration script
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git
commit 8358e6b5d3f9b2be2fa5f3f77eacb82cf3d817af
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Wed Jun 6 12:29:54 2018 -0400
AIRAVATA-2781 Using userHasAccess to test migration script
---
app/libraries/SharingUtilities.php | 28 ++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)
diff --git a/app/libraries/SharingUtilities.php b/app/libraries/SharingUtilities.php
index 1784da3..4924eef 100755
--- a/app/libraries/SharingUtilities.php
+++ b/app/libraries/SharingUtilities.php
@@ -25,18 +25,8 @@ class SharingUtilities {
* @return True if the user has read permission, false otherwise.
*/
public static function userCanRead($uid, $resourceId, $dataResourceType) {
- // If the user is the owner, then it is implied they can read the resource
- $owner = SharingUtilities::getSharedResourceOwner($resourceId, $dataResourceType);
- if ($uid == $owner) {
- return true;
- }
- $read = GrouperUtilities::getAllAccessibleUsers($resourceId, $dataResourceType, ResourcePermissionType::READ);
- foreach($read as $user) {
- if (strcmp($uid, $user) === 0) {
- return true;
- }
- }
- return false;
+
+ return Airavata::userHasAccess(Session::get('authz-token'), $resourceId, ResourcePermissionType::READ);
}
/**
@@ -48,18 +38,8 @@ class SharingUtilities {
* @return True if the user has write permission, false otherwise.
*/
public static function userCanWrite($uid, $resourceId, $dataResourceType) {
- // If the user is the owner, then it is implied they can write to the resource
- $owner = SharingUtilities::getSharedResourceOwner($resourceId, $dataResourceType);
- if ($uid == $owner) {
- return true;
- }
- $write = GrouperUtilities::getAllAccessibleUsers($resourceId, $dataResourceType, ResourcePermissionType::WRITE);
- foreach($write as $user) {
- if (strcmp($uid, $user) === 0) {
- return true;
- }
- }
- return false;
+
+ return Airavata::userHasAccess(Session::get('authz-token'), $resourceId, ResourcePermissionType::WRITE);
}
/**
--
To stop receiving notification emails like this one, please contact
machristie@apache.org.