dachcom-digital / pimcore-members

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

fix: falsely checking routes without contentDocument #149

Closed aarongerig closed 3 years ago

aarongerig commented 3 years ago
Q A
Branch? dev-master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no

This line is checking if route names contain document_ anywhere in them. In one project I had the route app_order_document_preview, which of course didn't contain a contentDocument key in the request. Because of that the restriction status check failed with the error:

Argument 1 passed to MembersBundle\Manager\RestrictionManager::getElementRestrictionStatus() must be an instance of Pimcore\Model\AbstractModel, null given

With this PR the check explicitly checks if the string begins with document_.

solverat commented 3 years ago

Good one! Thanks @aarongerig!