forked from mirror/Part-DB.Part-DB-server
Improved permission checking for certain controllers.
This commit is contained in:
parent
a30b67e328
commit
78d1dff40f
3 changed files with 10 additions and 1 deletions
|
@ -156,6 +156,11 @@ class TypeaheadController extends AbstractController
|
|||
public function parameters(string $type, EntityManagerInterface $entityManager, string $query = ""): JsonResponse
|
||||
{
|
||||
$class = $this->typeToParameterClass($type);
|
||||
|
||||
$test_obj = new $class();
|
||||
//Ensure user has the correct permissions
|
||||
$this->denyAccessUnlessGranted('read', $test_obj);
|
||||
|
||||
/** @var ParameterRepository $repository */
|
||||
$repository = $entityManager->getRepository($class);
|
||||
|
||||
|
@ -169,6 +174,8 @@ class TypeaheadController extends AbstractController
|
|||
*/
|
||||
public function tags(string $query, TagFinder $finder): JsonResponse
|
||||
{
|
||||
$this->denyAccessUnlessGranted('@parts.read');
|
||||
|
||||
$array = $finder->searchTags($query);
|
||||
|
||||
$normalizers = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue