From e90010bcccc15d4d90d52f2ec8caeaefc60f085c Mon Sep 17 00:00:00 2001 From: Maarten Segers Date: Mon, 3 Aug 2020 09:12:21 +0200 Subject: [PATCH] Split up OgAccess::userAccessEntity See #673. --- .../ValidOgMembershipReferenceConstraintValidator.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Plugin/Validation/Constraint/ValidOgMembershipReferenceConstraintValidator.php b/src/Plugin/Validation/Constraint/ValidOgMembershipReferenceConstraintValidator.php index a04185727..77bf8e822 100644 --- a/src/Plugin/Validation/Constraint/ValidOgMembershipReferenceConstraintValidator.php +++ b/src/Plugin/Validation/Constraint/ValidOgMembershipReferenceConstraintValidator.php @@ -40,10 +40,8 @@ public function validate($value, Constraint $constraint) { $entity = $this->context->getRoot()->getValue(); /** @var \Drupal\Core\Access\AccessResult $access */ - // @todo: Refactor the permission format in #510. - $permission = "create {$entity->bundle()} content"; $user = \Drupal::currentUser()->getAccount(); - $access = \Drupal::service('og.access')->userAccessEntity($permission, $group, $user); + $access = \Drupal::service('og.access')-> userAccessGroupContentEntityOperation('create', $entity, $group, $user); if ($access->isForbidden()) { $this->context->addViolation($constraint->notAllowedToPostInGroup, $params);