dachcom-digital / pimcore-members

Pimcore Object, Asset and Document Restriction & Frontend Authentication
Other
54 stars 34 forks source link

Fix the RestrictionQuery to prevent empty results/wrong query #167

Closed scrummer closed 2 years ago

scrummer commented 2 years ago
Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no

Description

There are basically two things to fix:

Query

i. The $queryIdentifier was set wrong in the Toolbox Bundle (assets.id instead of id). Therefore the resulting query contained assets.assets.id which is a non-existing field. ii. $query->where() and $query->groupBy() overrides the conditions/groups which are being applied by Pimcore in the Listing which leads to a parameter mismatch. Using andWhere() and addGroupBy() fixes that.

Join Behaviour

Using $query->join() performs an inner join which means that only assets, etc. with some restrictions defined appear in the result set. All without any definitions will be cut off. Using $query->leftJoin() keeps also results without restriction-definitions.