all: use typed perm methods
parent
af2a095059
commit
0e5806fddb
|
@ -329,7 +329,7 @@ class ApiBase extends Controller
|
|||
}
|
||||
|
||||
// Check read permission
|
||||
if (!($files[0]->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
|
||||
if (!$files[0]->isReadable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ class PeopleController extends ApiBase
|
|||
}
|
||||
|
||||
// Check read permission
|
||||
if (!($files[0]->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
|
||||
if (!$files[0]->isReadable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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}");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue