Photos: Fix unexisting permissions for clubs photo album

This commit is contained in:
veselcraft 2021-12-15 20:18:43 +03:00
parent cd91d4e310
commit e32aba2fd3
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E

View file

@ -131,9 +131,11 @@ final class PhotosPresenter extends OpenVKPresenter
if($album->getPrettyId() !== $owner . "_" . $id || $album->isDeleted()) if($album->getPrettyId() !== $owner . "_" . $id || $album->isDeleted())
$this->notFound(); $this->notFound();
if($owner > 0 /* bc we currently don't have perms for clubs */) $ownerObject = (new Users)->get($owner); if($owner > 0 /* bc we currently don't have perms for clubs */) {
if(!$ownerObject->getPrivacyPermission('photos.read', $this->user->identity ?? NULL)) $ownerObject = (new Users)->get($owner);
$this->flashFail("err", tr("forbidden"), tr("forbidden_comment")); if(!$ownerObject->getPrivacyPermission('photos.read', $this->user->identity ?? NULL))
$this->flashFail("err", tr("forbidden"), tr("forbidden_comment"));
}
$this->template->album = $album; $this->template->album = $album;
$this->template->photos = iterator_to_array( $album->getPhotos( (int) ($this->queryParam("p") ?? 1) ) ); $this->template->photos = iterator_to_array( $album->getPhotos( (int) ($this->queryParam("p") ?? 1) ) );