all: use typed perm methods

pull/465/head
Varun Patil 2023-03-09 16:44:56 -08:00
parent af2a095059
commit 0e5806fddb
6 changed files with 6 additions and 6 deletions

View File

@ -329,7 +329,7 @@ class ApiBase extends Controller
}
// Check read permission
if (!($files[0]->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
if (!$files[0]->isReadable()) {
continue;
}

View File

@ -54,7 +54,7 @@ class ArchiveController extends ApiBase
$file = $file[0];
// Check if user has permissions
if (!$file->isUpdateable() || !($file->getPermissions() & \OCP\Constants::PERMISSION_UPDATE)) {
if (!$file->isUpdateable()) {
return new JSONResponse(['message' => 'Cannot update this file'], Http::STATUS_FORBIDDEN);
}

View File

@ -228,7 +228,7 @@ class ImageController extends ApiBase
}
// Check if user has permissions
if (!$file->isUpdateable() || !($file->getPermissions() & \OCP\Constants::PERMISSION_UPDATE)) {
if (!$file->isUpdateable()) {
return new JSONResponse([], Http::STATUS_FORBIDDEN);
}

View File

@ -212,7 +212,7 @@ class PeopleController extends ApiBase
}
// Check read permission
if (!($files[0]->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
if (!$files[0]->isReadable()) {
continue;
}

View File

@ -58,7 +58,7 @@ class VideoController extends ApiBase
return new JSONResponse(['message' => 'File not found'], Http::STATUS_NOT_FOUND);
}
if (!($file->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
if (!$file->isReadable()) {
return new JSONResponse(['message' => 'File not readable'], Http::STATUS_FORBIDDEN);
}

View File

@ -32,7 +32,7 @@ class TimelineRoot
throw new \Exception("Not a folder: {$folderPath}");
}
if (!($folder->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
if (!$folder->isReadable()) {
throw new \Exception("Folder not readable: {$folderPath}");
}