Groups: Remove the ability for those who are not group administrators to publish posts, comments and topics on behalf of the group

Before this commit, this could be done by sending the corresponding parameter in the POST request (but the checkbox for this was not displayed by default)
This commit is contained in:
Maxim Leshchenko 2021-12-15 19:19:13 +02:00
parent e32aba2fd3
commit c0acfd7f7f
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
3 changed files with 8 additions and 3 deletions

View file

@ -42,8 +42,13 @@ final class CommentPresenter extends OpenVKPresenter
if($entity instanceof Topic && $entity->isClosed())
$this->notFound();
if($entity instanceof Post && $entity->getTargetWall() > 0)
$club = (new Clubs)->get(abs($entity->getTargetWall()));
else if($entity instanceof Topic)
$club = $entity->getClub();
$flags = 0;
if($this->postParam("as_group") === "on")
if($this->postParam("as_group") === "on" && !is_null($club) && $club->canBeModifiedBy($this->user->identity))
$flags |= 0b10000000;
$photo = NULL;

View file

@ -80,7 +80,7 @@ final class TopicsPresenter extends OpenVKPresenter
$this->flashFail("err", tr("failed_to_create_topic"), tr("no_title_specified"));
$flags = 0;
if($this->postParam("as_group") === "on")
if($this->postParam("as_group") === "on" && $club->canBeModifiedBy($this->user->identity))
$flags |= 0b10000000;
$topic = new Topic;

View file

@ -197,7 +197,7 @@ final class WallPresenter extends OpenVKPresenter
}
$flags = 0;
if($this->postParam("as_group") === "on")
if($this->postParam("as_group") === "on" && $wallOwner instanceof Club && $wallOwner->canBeModifiedBy($this->user->identity))
$flags |= 0b10000000;
if($this->postParam("force_sign") === "on")
$flags |= 0b01000000;