Skip to content

Conversation

@GoZOo
Copy link
Contributor

@GoZOo GoZOo commented Feb 23, 2018

Problem/Motivation

Fatal error occur when trying to check access on a coupon which is not attached to a promotion.

Proposed resolution

Check coupon has promotion before using the access method of this promotion.

See https://www.drupal.org/project/commerce/issues/2947227

$result = parent::checkAccess($entity, $operation, $account);

if ($result->isNeutral()) {
if ($result->isNeutral() && $promotion = $entity->getPromotion()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no promotion it should always be false, because nothing can be applied.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should explicitly deny.

This is part of the bigger data integrity issues we have.

@bojanz
Copy link
Contributor

bojanz commented Aug 21, 2018

Let's finish this on the issue.

@bojanz bojanz closed this Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants