-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Entitlements improve and refactoring. (#245)
* Entitlements improve and refactoring. * switch to PHP 8.2 --------- Co-authored-by: Illya Havsiyevych <[email protected]>
- Loading branch information
1 parent
4a4bb4d
commit c394af5
Showing
12 changed files
with
255 additions
and
424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bypass dataset access: | ||
title: 'Bypass dataset access' | ||
description: 'View all datasets and related content regardless of permission restrictions.' | ||
restrict access: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 0 additions & 74 deletions
74
modules/quanthub_core/src/Cache/Context/UserInfoAttributesCacheContext.php
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
modules/quanthub_core/src/Plugin/Field/FieldType/QuantHubUrnComputedList.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace Drupal\quanthub_core\Plugin\Field\FieldType; | ||
|
||
use Drupal\Core\Cache\CacheableDependencyInterface; | ||
use Drupal\Core\Cache\RefinableCacheableDependencyTrait; | ||
use Drupal\Core\Entity\FieldableEntityInterface; | ||
use Drupal\Core\Field\EntityReferenceFieldItemListInterface; | ||
use Drupal\Core\Field\FieldItemList; | ||
use Drupal\Core\TypedData\ComputedItemListTrait; | ||
|
||
/** | ||
* Computed field to proxy QuantHub URN from references. | ||
*/ | ||
class QuantHubUrnComputedList extends FieldItemList implements CacheableDependencyInterface { | ||
|
||
use ComputedItemListTrait; | ||
use RefinableCacheableDependencyTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function computeValue() { | ||
$this->list = []; | ||
|
||
$entity = $this->getEntity(); | ||
$field_name = $this->getFieldDefinition()->getSetting('field_reference_name'); | ||
if (!$field_name || !$entity->hasField($field_name)) { | ||
return; | ||
} | ||
$references = $entity->get($field_name); | ||
if (!$references instanceof EntityReferenceFieldItemListInterface) { | ||
return; | ||
} | ||
|
||
$urns = []; | ||
foreach ($references->referencedEntities() as $referencedEntity) { | ||
if ( | ||
!$referencedEntity instanceof FieldableEntityInterface || | ||
!$referencedEntity->hasField('field_quanthub_urn') | ||
) { | ||
continue; | ||
} | ||
|
||
$this->addCacheableDependency($referencedEntity); | ||
|
||
$field = $referencedEntity->get('field_quanthub_urn'); | ||
if ($field instanceof CacheableDependencyInterface) { | ||
$this->addCacheableDependency($field); | ||
} | ||
|
||
foreach ($field as $item) { | ||
if ($item instanceof CacheableDependencyInterface) { | ||
$this->addCacheableDependency($item); | ||
} | ||
if ($item->value) { | ||
$urns[] = $item->value; | ||
} | ||
} | ||
} | ||
|
||
foreach (array_values(array_unique($urns)) as $delta => $urn) { | ||
$this->list[$delta] = $this->createItem($delta, $urn); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.