Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
Split up OgAccess::userAccessEntity
Browse files Browse the repository at this point in the history
See #673.
  • Loading branch information
MPParsley authored Aug 3, 2020
1 parent 1ea6272 commit e90010b
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e90010b

Please sign in to comment.