AIRAVATA-2781 Using userHasAccess to test migration script
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 @@
* @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 @@
* @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);
}
/**