Update Post model

Prevent moderators from editing and deleting posts of administrators.
This commit is contained in:
Visman 2021-03-12 15:27:40 +07:00
parent 897700a15e
commit 50eb9e5111

View file

@ -98,12 +98,14 @@ class Model extends DataModel
*/
protected function getcanDelete(): bool
{
if ($this->c->user->isGuest) {
return false;
if ($this->c->user->isAdmin) {
return true;
} elseif (
$this->c->user->isAdmin
|| $this->c->user->isModerator($this)
$this->c->user->isGuest
|| isset($this->c->admins->list[$this->poster_id]) // ???? или юзера проверять?
) {
return false;
} elseif ($this->c->user->isModerator($this)) {
return true;
} elseif ('1' == $this->parent->closed) {
return false;
@ -145,12 +147,14 @@ class Model extends DataModel
*/
protected function getcanEdit(): bool
{
if ($this->c->user->isGuest) {
return false;
if ($this->c->user->isAdmin) {
return true;
} elseif (
$this->c->user->isAdmin
|| $this->c->user->isModerator($this)
$this->c->user->isGuest
|| isset($this->c->admins->list[$this->poster_id]) // ???? или юзера проверять?
) {
return false;
} elseif ($this->c->user->isModerator($this)) {
return true;
} elseif ('1' == $this->parent->closed) {
return false;