diff --git a/app/Auth/Permissions/JointPermissionBuilder.php b/app/Auth/Permissions/JointPermissionBuilder.php index 9ee09a3a6..f377eef5c 100644 --- a/app/Auth/Permissions/JointPermissionBuilder.php +++ b/app/Auth/Permissions/JointPermissionBuilder.php @@ -148,7 +148,6 @@ class JointPermissionBuilder ]); } - /** * Build joint permissions for the given book and role combinations. */ @@ -207,6 +206,7 @@ class JointPermissionBuilder /** * @param Entity[] $entities + * * @return SimpleEntityData[] */ protected function entitiesToSimpleEntities(array $entities): array @@ -288,7 +288,9 @@ class JointPermissionBuilder /** * From the given entity list, provide back a mapping of entity types to * the ids of that given type. The type used is the DB morph class. + * * @param SimpleEntityData[] $entities + * * @return array */ protected function entitiesToTypeIdMap(array $entities): array @@ -307,8 +309,10 @@ class JointPermissionBuilder } /** - * Get the entity permissions for all the given entities + * Get the entity permissions for all the given entities. + * * @param SimpleEntityData[] $entities + * * @return EntityPermission[] */ protected function getEntityPermissionsForEntities(array $entities): array @@ -316,7 +320,7 @@ class JointPermissionBuilder $idsByType = $this->entitiesToTypeIdMap($entities); $permissionFetch = EntityPermission::query() ->where('action', '=', 'view') - ->where(function(Builder $query) use ($idsByType) { + ->where(function (Builder $query) use ($idsByType) { foreach ($idsByType as $type => $ids) { $query->orWhere(function (Builder $query) use ($type, $ids) { $query->where('restrictable_type', '=', $type)->whereIn('restrictable_id', $ids); @@ -398,5 +402,4 @@ class JointPermissionBuilder 'role_id' => $roleId, ]; } - -} \ No newline at end of file +} diff --git a/app/Auth/Permissions/PermissionApplicator.php b/app/Auth/Permissions/PermissionApplicator.php index b89857c5c..d855a6170 100644 --- a/app/Auth/Permissions/PermissionApplicator.php +++ b/app/Auth/Permissions/PermissionApplicator.php @@ -86,7 +86,7 @@ class PermissionApplicator public function checkUserHasEntityPermissionOnAny(string $action, string $entityClass = ''): bool { if (strpos($action, '-') !== false) { - throw new InvalidArgumentException("Action should be a simple entity permission action, not a role permission"); + throw new InvalidArgumentException('Action should be a simple entity permission action, not a role permission'); } $permissionQuery = EntityPermission::query() diff --git a/app/Auth/Permissions/SimpleEntityData.php b/app/Auth/Permissions/SimpleEntityData.php index 0d1c94b0d..6ec0c4179 100644 --- a/app/Auth/Permissions/SimpleEntityData.php +++ b/app/Auth/Permissions/SimpleEntityData.php @@ -10,4 +10,4 @@ class SimpleEntityData public int $owned_by; public ?int $book_id; public ?int $chapter_id; -} \ No newline at end of file +} diff --git a/app/Entities/Tools/SearchRunner.php b/app/Entities/Tools/SearchRunner.php index 459409084..78659b786 100644 --- a/app/Entities/Tools/SearchRunner.php +++ b/app/Entities/Tools/SearchRunner.php @@ -21,7 +21,6 @@ use SplObjectStorage; class SearchRunner { - protected EntityProvider $entityProvider; protected PermissionApplicator $permissions; diff --git a/app/Providers/CustomFacadeProvider.php b/app/Providers/CustomFacadeProvider.php index 04de82250..6ba5632e6 100644 --- a/app/Providers/CustomFacadeProvider.php +++ b/app/Providers/CustomFacadeProvider.php @@ -3,9 +3,7 @@ namespace BookStack\Providers; use BookStack\Actions\ActivityLogger; -use BookStack\Auth\Permissions\PermissionApplicator; use BookStack\Theming\ThemeService; -use BookStack\Uploads\ImageService; use Illuminate\Support\ServiceProvider; class CustomFacadeProvider extends ServiceProvider diff --git a/tests/Entity/EntitySearchTest.php b/tests/Entity/EntitySearchTest.php index 55c54695e..a23a2fd26 100644 --- a/tests/Entity/EntitySearchTest.php +++ b/tests/Entity/EntitySearchTest.php @@ -234,7 +234,7 @@ class EntitySearchTest extends TestCase { $page = Page::query()->first(); $baseSelector = 'a[data-entity-type="page"][data-entity-id="' . $page->id . '"]'; - $searchUrl = "/ajax/search/entities?permission=update&term=" . urlencode($page->name); + $searchUrl = '/ajax/search/entities?permission=update&term=' . urlencode($page->name); $resp = $this->asEditor()->get($searchUrl); $resp->assertElementContains($baseSelector, $page->name); diff --git a/tests/SharedTestHelpers.php b/tests/SharedTestHelpers.php index 99bc92494..bc7b10266 100644 --- a/tests/SharedTestHelpers.php +++ b/tests/SharedTestHelpers.php @@ -3,7 +3,6 @@ namespace Tests; use BookStack\Auth\Permissions\JointPermissionBuilder; -use BookStack\Auth\Permissions\PermissionApplicator; use BookStack\Auth\Permissions\PermissionsRepo; use BookStack\Auth\Permissions\RolePermission; use BookStack\Auth\Role;