Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/node/src/NodeAccessControlHandler.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
48 $entity_type, | 48 $entity_type, |
49 $container->get('node.grant_storage') | 49 $container->get('node.grant_storage') |
50 ); | 50 ); |
51 } | 51 } |
52 | 52 |
53 | |
54 /** | 53 /** |
55 * {@inheritdoc} | 54 * {@inheritdoc} |
56 */ | 55 */ |
57 public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE) { | 56 public function access(EntityInterface $entity, $operation, AccountInterface $account = NULL, $return_as_object = FALSE) { |
58 $account = $this->prepareUser($account); | 57 $account = $this->prepareUser($account); |
79 if ($account->hasPermission('bypass node access')) { | 78 if ($account->hasPermission('bypass node access')) { |
80 $result = AccessResult::allowed()->cachePerPermissions(); | 79 $result = AccessResult::allowed()->cachePerPermissions(); |
81 return $return_as_object ? $result : $result->isAllowed(); | 80 return $return_as_object ? $result : $result->isAllowed(); |
82 } | 81 } |
83 if (!$account->hasPermission('access content')) { | 82 if (!$account->hasPermission('access content')) { |
84 $result = AccessResult::forbidden()->cachePerPermissions(); | 83 $result = AccessResult::forbidden("The 'access content' permission is required.")->cachePerPermissions(); |
85 return $return_as_object ? $result : $result->isAllowed(); | 84 return $return_as_object ? $result : $result->isAllowed(); |
86 } | 85 } |
87 | 86 |
88 $result = parent::createAccess($entity_bundle, $account, $context, TRUE)->cachePerPermissions(); | 87 $result = parent::createAccess($entity_bundle, $account, $context, TRUE)->cachePerPermissions(); |
89 return $return_as_object ? $result : $result->isAllowed(); | 88 return $return_as_object ? $result : $result->isAllowed(); |