Skip to content
Snippets Groups Projects
Commit a2bfc647 authored by Jennifer Dust's avatar Jennifer Dust Committed by Travis Tomka
Browse files

Issue #3342204 by jldust, COBadger: Drupal 10 readiness

parent ee284245
No related branches found
No related tags found
1 merge request!1Issue #3342204: Drupal 10 readiness
type: module
name: Entity Access Groups
description: Create entity access groups to restrict access based on entity relationships.
core_version_requirement: ^8.7.7 || ^9
php: 7.2
core_version_requirement: ^9 || ^10
php: 8.1
package: Other
configure: entity.entity_access_group.collection
......@@ -57,6 +57,7 @@ class NodeAccessGroupManagement extends ControllerBase {
$user_storage = $this->entityTypeManager()->getStorage('user');
$user_ids = $user_storage->getQuery()
->accessCheck()
->condition("{$reference_field}.target_id", $node->id())
->condition('status', NodeInterface::PUBLISHED)
->execute();
......
......@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Drupal\entity_access_groups;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\Query\QueryInterface;
/**
* Define the entity exist trait.
......@@ -21,10 +22,9 @@ trait EntityExistTrait {
* Return TRUE if entity exist for that identifier; otherwise FALSE.
*/
public function exists(string $identifier): bool {
return (bool) $this->entityStorage()->getQuery()->condition(
$this->getEntityType()->getKey('id'),
$identifier
)->execute();
$query = $this->entityStorage()->getQuery();
$query->condition($this->getEntityType()->getKey('id'), $identifier);
return (bool) $query->accessCheck()->execute();
}
/**
......
......@@ -187,6 +187,7 @@ class EntityAccessGroupUserAddForm extends FormBase {
if (isset($username) && !empty($username)) {
$user_ids = $this->getUserStorage()
->getQuery()
->accessCheck()
->condition('status', TRUE)
->condition('name', $username, 'CONTAINS')
->sort('name', 'ASC')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment