@@ -55,7 +55,7 @@ public function getNewDraftPage(Entity $parent)
5555 }
5656
5757 $ defaultTemplate = $ page ->chapter ->defaultTemplate ?? $ page ->book ->defaultTemplate ;
58- if ($ defaultTemplate && userCan (' view ' , $ defaultTemplate )) {
58+ if ($ defaultTemplate && userCan (\ BookStack \ Permissions \Permission::View , $ defaultTemplate )) {
5959 $ page ->forceFill ([
6060 'html ' => $ defaultTemplate ->html ,
6161 'markdown ' => $ defaultTemplate ->markdown ,
@@ -142,7 +142,7 @@ public function update(Page $page, array $input): Page
142142
143143 protected function updateTemplateStatusAndContentFromInput (Page $ page , array $ input ): void
144144 {
145- if (isset ($ input ['template ' ]) && userCan (' templates-manage ' )) {
145+ if (isset ($ input ['template ' ]) && userCan (\ BookStack \ Permissions \Permission::TemplatesManage )) {
146146 $ page ->template = ($ input ['template ' ] === 'true ' );
147147 }
148148
@@ -165,7 +165,7 @@ protected function updateTemplateStatusAndContentFromInput(Page $page, array $in
165165 $ pageContent ->setNewHTML ($ input ['html ' ], user ());
166166 }
167167
168- if (($ newEditor !== $ currentEditor || empty ($ page ->editor )) && userCan (' editor-change ' )) {
168+ if (($ newEditor !== $ currentEditor || empty ($ page ->editor )) && userCan (\ BookStack \ Permissions \Permission::EditorChange )) {
169169 $ page ->editor = $ newEditor ->value ;
170170 } elseif (empty ($ page ->editor )) {
171171 $ page ->editor = $ defaultEditor ->value ;
@@ -271,7 +271,7 @@ public function move(Page $page, string $parentIdentifier): Entity
271271 throw new MoveOperationException ('Book or chapter to move page into not found ' );
272272 }
273273
274- if (!userCan (' page-create ' , $ parent )) {
274+ if (!userCan (\ BookStack \ Permissions \Permission::PageCreate , $ parent )) {
275275 throw new PermissionsException ('User does not have permission to create a page within the new parent ' );
276276 }
277277
0 commit comments