]> BookStack Code Mirror - bookstack/commitdiff
Perms: Removed entity perm regen on general update
authorDan Brown <redacted>
Wed, 2 Jul 2025 11:15:25 +0000 (12:15 +0100)
committerDan Brown <redacted>
Wed, 2 Jul 2025 11:15:25 +0000 (12:15 +0100)
Should not be needed here as this is not directly used for information
which should impact permissions.
Been through uses to ensure that this is the case.

app/Entities/Repos/BaseRepo.php
app/Entities/Repos/PageRepo.php
app/Sorting/BookSorter.php

index 151d5b0555bbc5fc884c23b8612d10e73884b36d..ac5a44e679dbc70f9d9c8563231aeea5ed06e22b 100644 (file)
@@ -77,7 +77,6 @@ class BaseRepo
             $entity->touch();
         }
 
-        $entity->rebuildPermissions();
         $entity->indexForSearch();
         $this->referenceStore->updateForEntity($entity);
 
@@ -139,7 +138,7 @@ class BaseRepo
 
     /**
      * Sort the parent of the given entity, if any auto sort actions are set for it.
-     * Typical ran during create/update/insert events.
+     * Typically ran during create/update/insert events.
      */
     public function sortParent(Entity $entity): void
     {
index c3be6d826a26dd87a3eea69aa9646abadcd664ca..f081b33dc3aa1558f4f0606090c56563a9fdf1b6 100644 (file)
@@ -77,6 +77,7 @@ class PageRepo
         $draft->priority = $this->getNewPriority($draft);
         $this->updateTemplateStatusAndContentFromInput($draft, $input);
         $this->baseRepo->update($draft, $input);
+        $draft->rebuildPermissions();
 
         $summary = trim($input['summary'] ?? '') ?: trans('entities.pages_initial_revision');
         $this->revisionRepo->storeNewForPage($draft, $summary);
@@ -91,7 +92,7 @@ class PageRepo
     /**
      * Directly update the content for the given page from the provided input.
      * Used for direct content access in a way that performs required changes
-     * (Search index & reference regen) without performing an official update.
+     * (Search index and reference regen) without performing an official update.
      */
     public function setContentFromInput(Page $page, array $input): void
     {
index 6710f070ad6669d7fa5012a8f3f33c734a3d7a33..cf41a6a94d0e8b3d96ce01798724b995baa10fde 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace BookStack\Sorting;
 
-use BookStack\App\Model;
 use BookStack\Entities\Models\Book;
 use BookStack\Entities\Models\BookChild;
 use BookStack\Entities\Models\Chapter;