mirror of
https://github.com/openvk/openvk
synced 2024-11-13 10:39:24 +03:00
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:
parent
e32aba2fd3
commit
c0acfd7f7f
3 changed files with 8 additions and 3 deletions
|
@ -41,9 +41,14 @@ 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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue