improve permissison handling in invoice screen (#2965)
This commit is contained in:
@@ -241,7 +241,8 @@ class CustomerRepository extends EntityRepository
|
||||
|
||||
$outerQuery = $qb->expr()->orX();
|
||||
|
||||
if ($query->hasCustomers()) {
|
||||
// this is a risk, as a user can manipulate the query and inject IDs that would be hidden otherwise
|
||||
if ($query->isAllowCustomerPreselect() && $query->hasCustomers()) {
|
||||
$outerQuery->add($qb->expr()->in('c.id', ':customer'));
|
||||
$qb->setParameter('customer', $query->getCustomers());
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ final class CustomerFormTypeQuery extends BaseFormTypeQuery
|
||||
* @var Customer|null
|
||||
*/
|
||||
private $customerToIgnore;
|
||||
private $allowCustomerPreselect = false;
|
||||
|
||||
/**
|
||||
* @param Customer|int|null $customer
|
||||
@@ -34,6 +35,16 @@ final class CustomerFormTypeQuery extends BaseFormTypeQuery
|
||||
}
|
||||
}
|
||||
|
||||
public function isAllowCustomerPreselect(): bool
|
||||
{
|
||||
return $this->allowCustomerPreselect;
|
||||
}
|
||||
|
||||
public function setAllowCustomerPreselect(bool $allowCustomerPreselect): void
|
||||
{
|
||||
$this->allowCustomerPreselect = $allowCustomerPreselect;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Customer|null
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user