Skip to content

Commit

Permalink
Added admin_only rule to internal canEditWikiPage function
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh4 committed Oct 30, 2020
1 parent 5883fd3 commit 291871d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions models/WikiPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,18 @@ public function afterSave($insert, $changedAttributes)
}

/**
* Additional canEdit see [[Content::canEdit()]].
* Note this function is not called directly but called by Content::canEdit() with additional checks
* Internal edit logic for wiki pages.
*
* @return bool
public function canEdit()
{
return !$this->admin_only ? $this->content->container->can(EditPages::class) : false;
} */

* @throws \Throwable
* @throws \yii\base\Exception
* @throws \yii\base\InvalidConfigException
* @throws \yii\db\IntegrityException
*/
public function canEditWikiPage()
{
return $this->content->container->can(EditPages::class);
// Can edit
return $this->content->canEdit() || (!$this->admin_only && $this->content->container->can(EditPages::class));
}

/**
Expand Down

0 comments on commit 291871d

Please sign in to comment.