Skip to content

Commit

Permalink
Fix for rateplan issue when developer is not present (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
divya-intelli authored Aug 29, 2023
1 parent bf25f8f commit 3ddaa1b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Entity/Access/RatePlanSubscriptionAccessHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ public function access(RatePlanInterface $rate_plan_entity, UserInterface $accou
// If rate plan is a developer rate plan, and the assigned developer is
// different from account, deny access.
if ($rate_plan instanceof DeveloperRatePlanInterface) {
if ($developer = $rate_plan->getDeveloper()) {
$developer = $rate_plan->getDeveloper();
if ($developer) {
return AccessResult::allowedIf($account->getEmail() === $developer->getEmail());
}
return AccessResult::forbidden("User {$developer->getEmail()} cannot subscribe to developer rate plan.");
else {
return AccessResult::forbidden("Missing developer reference on {$rate_plan->id()} rate plan.");
}
}

if ($rate_plan instanceof CompanyRatePlanInterface) {
Expand Down

0 comments on commit 3ddaa1b

Please sign in to comment.