From 0e5806fddbb9129ceed5dcf56717dc7e536ecef0 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Thu, 9 Mar 2023 16:44:56 -0800 Subject: [PATCH] all: use typed perm methods --- lib/Controller/ApiBase.php | 2 +- lib/Controller/ArchiveController.php | 2 +- lib/Controller/ImageController.php | 2 +- lib/Controller/PeopleController.php | 2 +- lib/Controller/VideoController.php | 2 +- lib/Db/TimelineRoot.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Controller/ApiBase.php b/lib/Controller/ApiBase.php index d4fe00fb..ac9c9bce 100644 --- a/lib/Controller/ApiBase.php +++ b/lib/Controller/ApiBase.php @@ -329,7 +329,7 @@ class ApiBase extends Controller } // Check read permission - if (!($files[0]->getPermissions() & \OCP\Constants::PERMISSION_READ)) { + if (!$files[0]->isReadable()) { continue; } diff --git a/lib/Controller/ArchiveController.php b/lib/Controller/ArchiveController.php index 8681cb32..8eb9c791 100644 --- a/lib/Controller/ArchiveController.php +++ b/lib/Controller/ArchiveController.php @@ -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); } diff --git a/lib/Controller/ImageController.php b/lib/Controller/ImageController.php index 17c9f25a..f605ca58 100644 --- a/lib/Controller/ImageController.php +++ b/lib/Controller/ImageController.php @@ -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); } diff --git a/lib/Controller/PeopleController.php b/lib/Controller/PeopleController.php index d23270f5..d52a9211 100644 --- a/lib/Controller/PeopleController.php +++ b/lib/Controller/PeopleController.php @@ -212,7 +212,7 @@ class PeopleController extends ApiBase } // Check read permission - if (!($files[0]->getPermissions() & \OCP\Constants::PERMISSION_READ)) { + if (!$files[0]->isReadable()) { continue; } diff --git a/lib/Controller/VideoController.php b/lib/Controller/VideoController.php index cf2bba5a..75ccac3c 100644 --- a/lib/Controller/VideoController.php +++ b/lib/Controller/VideoController.php @@ -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); } diff --git a/lib/Db/TimelineRoot.php b/lib/Db/TimelineRoot.php index fc6b8f52..05b3ad19 100644 --- a/lib/Db/TimelineRoot.php +++ b/lib/Db/TimelineRoot.php @@ -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}"); }