From 291871d8b84eb7b82e9e3b369879f1e313510110 Mon Sep 17 00:00:00 2001 From: buddh4 Date: Fri, 30 Oct 2020 16:08:20 +0100 Subject: [PATCH] Added admin_only rule to internal canEditWikiPage function --- models/WikiPage.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/models/WikiPage.php b/models/WikiPage.php index c29cecd7..0b23e604 100644 --- a/models/WikiPage.php +++ b/models/WikiPage.php @@ -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)); } /**