From e32aba2fd305b697cd7599a447abea8a825a9fa4 Mon Sep 17 00:00:00 2001 From: veselcraft Date: Wed, 15 Dec 2021 20:18:43 +0300 Subject: [PATCH] Photos: Fix unexisting permissions for clubs photo album --- Web/Presenters/PhotosPresenter.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Web/Presenters/PhotosPresenter.php b/Web/Presenters/PhotosPresenter.php index 78c17c1e..24531222 100644 --- a/Web/Presenters/PhotosPresenter.php +++ b/Web/Presenters/PhotosPresenter.php @@ -131,9 +131,11 @@ final class PhotosPresenter extends OpenVKPresenter if($album->getPrettyId() !== $owner . "_" . $id || $album->isDeleted()) $this->notFound(); - if($owner > 0 /* bc we currently don't have perms for clubs */) $ownerObject = (new Users)->get($owner); - if(!$ownerObject->getPrivacyPermission('photos.read', $this->user->identity ?? NULL)) - $this->flashFail("err", tr("forbidden"), tr("forbidden_comment")); + if($owner > 0 /* bc we currently don't have perms for clubs */) { + $ownerObject = (new Users)->get($owner); + if(!$ownerObject->getPrivacyPermission('photos.read', $this->user->identity ?? NULL)) + $this->flashFail("err", tr("forbidden"), tr("forbidden_comment")); + } $this->template->album = $album; $this->template->photos = iterator_to_array( $album->getPhotos( (int) ($this->queryParam("p") ?? 1) ) );