improve permissison handling in invoice screen (#2965)

This commit is contained in:
Kevin Papst
2021-11-21 16:41:03 +01:00
committed by GitHub
parent 76e09447c8
commit ff9acab0fc
15 changed files with 183 additions and 124 deletions

View File

@@ -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());
}

View File

@@ -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
*/