This commit is contained in:
n1rwana 2022-08-27 23:23:05 +03:00
parent aaad80f4f8
commit ae0258c78b
4 changed files with 20 additions and 5 deletions

View file

@ -439,7 +439,7 @@ class User extends RowModel
else if($user->getId() === $this->getId()) else if($user->getId() === $this->getId())
return true; return true;
else if ((new Blacklists)->isBanned($this, $user)) { else if ((new Blacklists)->isBanned($this, $user)) {
if ($user->isAdmin()) if ($user->isAdmin() && !OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"])
return true; return true;
return false; return false;

View file

@ -140,6 +140,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 ((new Blacklists)->isBanned($album->getOwner(), $this->user->identity)) {
if (!$this->user->identity->isAdmin() OR $this->user->identity->isAdmin() AND OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"])
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
}
if($owner > 0 /* bc we currently don't have perms for clubs */) { if($owner > 0 /* bc we currently don't have perms for clubs */) {
$ownerObject = (new Users)->get($owner); $ownerObject = (new Users)->get($owner);
if(!$ownerObject->getPrivacyPermission('photos.read', $this->user->identity ?? NULL)) { if(!$ownerObject->getPrivacyPermission('photos.read', $this->user->identity ?? NULL)) {
@ -166,8 +171,10 @@ final class PhotosPresenter extends OpenVKPresenter
$photo = $this->photos->getByOwnerAndVID($ownerId, $photoId); $photo = $this->photos->getByOwnerAndVID($ownerId, $photoId);
if(!$photo || $photo->isDeleted()) $this->notFound(); if(!$photo || $photo->isDeleted()) $this->notFound();
if ((new Blacklists)->isBanned($photo->getOwner(), $this->user->identity)) if ((new Blacklists)->isBanned($photo->getOwner(), $this->user->identity)) {
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список."); if (!$this->user->identity->isAdmin() OR $this->user->identity->isAdmin() AND OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"])
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
}
if(!is_null($this->queryParam("from"))) { if(!is_null($this->queryParam("from"))) {
if(preg_match("%^album([0-9]++)$%", $this->queryParam("from"), $matches) === 1) { if(preg_match("%^album([0-9]++)$%", $this->queryParam("from"), $matches) === 1) {

View file

@ -32,8 +32,14 @@ final class UserPresenter extends OpenVKPresenter
$user = $this->users->get($id); $user = $this->users->get($id);
if ($this->user->identity) if ($this->user->identity)
if ($this->blacklists->isBanned($user, $this->user->identity) && !$this->user->identity->isAdmin()) if ($this->blacklists->isBanned($user, $this->user->identity)) {
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список."); if ($this->user->identity->isAdmin()) {
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"])
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
} else {
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
}
}
if(!$user || $user->isDeleted()) { if(!$user || $user->isDeleted()) {
if($user->isDeactivated()) { if($user->isDeactivated()) {

View file

@ -33,6 +33,8 @@ openvk:
maxViolations: 50 maxViolations: 50
maxViolationsAge: 120 maxViolationsAge: 120
autoban: true autoban: true
blacklists:
applyToAdmins: true
registration: registration:
enable: true enable: true
reason: "" # reason for disabling registration reason: "" # reason for disabling registration