1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Started removal of non-view permission queries

Updated ajax search and entity selector usage to display and handle
items that the user does not have permission to interact with.
Started logic changes to not allow permission type to be passed around,
with views instead being the fixed sole permission.
This commit is contained in:
Dan Brown
2022-07-13 15:23:03 +01:00
parent 2989852520
commit 4fb85a9a5c
10 changed files with 47 additions and 15 deletions

View File

@ -12,7 +12,6 @@ use Illuminate\Http\Request;
class SearchController extends Controller
{
protected $searchRunner;
protected $entityContextManager;
public function __construct(SearchRunner $searchRunner)
{
@ -79,12 +78,12 @@ class SearchController extends Controller
// Search for entities otherwise show most popular
if ($searchTerm !== false) {
$searchTerm .= ' {type:' . implode('|', $entityTypes) . '}';
$entities = $this->searchRunner->searchEntities(SearchOptions::fromString($searchTerm), 'all', 1, 20, $permission)['results'];
$entities = $this->searchRunner->searchEntities(SearchOptions::fromString($searchTerm), 'all', 1, 20)['results'];
} else {
$entities = (new Popular())->run(20, 0, $entityTypes, $permission);
$entities = (new Popular())->run(20, 0, $entityTypes);
}
return view('search.parts.entity-ajax-list', ['entities' => $entities]);
return view('search.parts.entity-ajax-list', ['entities' => $entities, 'permission' => $permission]);
}
/**