Update Post model
Prevent moderators from editing and deleting posts of administrators.
This commit is contained in:
parent
897700a15e
commit
50eb9e5111
1 changed files with 12 additions and 8 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue