Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ on:

jobs:
PHPUnit:
uses: discoverygarden/phpunit-action/.github/workflows/phpunit.yml@v1
uses: discoverygarden/phpunit-action/.github/workflows/phpunit.yml@fix/update-matrix
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is pointing at discoverygarden/phpunit-action#26 to fix tests. Should probably be merged and pointed at before this PR is merged.

secrets: inherit
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "drupal-module",
"license": "GPL-3.0-or-later",
"require": {
"islandora/islandora": "^2"
"drupal/islandora": "^2"
},
"require-dev": {
"drupal/test_support": "^1"
Expand Down
14 changes: 7 additions & 7 deletions islandora_hierarchical_access.module
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function islandora_hierarchical_access_entity_delete(EntityInterface $entity) :
function islandora_hierarchical_access_entity_access(
EntityInterface $entity,
$operation,
AccountInterface $account
AccountInterface $account,
) : AccessResultInterface {
/** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
$entity_type_manager = \Drupal::service('entity_type.manager');
Expand All @@ -103,9 +103,9 @@ function islandora_hierarchical_access_query_file_access_alter(AlterableInterfac
// We expect that things should be handled via our event instead.
return;
}
assert($query->getMetaData('islandora_hierarchical_access_tag_type') === NULL);
\Drupal::service('islandora_hierarchical_access.query_tagger')
->tagQuery($query->addMetaData('islandora_hierarchical_access_tag_type', 'file'));
/** @var \Drupal\islandora_hierarchical_access\Access\QueryTagger $tagger */
$tagger = \Drupal::service('islandora_hierarchical_access.query_tagger');
$tagger->tagQuery($query, 'file');
}

/**
Expand All @@ -116,7 +116,7 @@ function islandora_hierarchical_access_query_media_access_alter(AlterableInterfa
// We expect that things should be handled via our event instead.
return;
}
assert($query->getMetaData('islandora_hierarchical_access_tag_type') === NULL);
\Drupal::service('islandora_hierarchical_access.query_tagger')
->tagQuery($query->addMetaData('islandora_hierarchical_access_tag_type', 'media'));
/** @var \Drupal\islandora_hierarchical_access\Access\QueryTagger $tagger */
$tagger = \Drupal::service('islandora_hierarchical_access.query_tagger');
$tagger->tagQuery($query, 'media');
}
7 changes: 5 additions & 2 deletions src/Access/QueryTagger.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ public static function create(ContainerInterface $container) : self {
*
* @param \Drupal\Core\Database\Query\SelectInterface $query
* The query to be altered.
* @param string $type
* The type of entity for which we are altering the query. Expecting one of:
* - media; and,
* - file.
*/
public function tagQuery(SelectInterface $query) : void {
$type = $query->getMetaData('islandora_hierarchical_access_tag_type');
public function tagQuery(SelectInterface $query, string $type) : void {
if (!in_array($type, ['media', 'file'])) {
throw new \InvalidArgumentException("Unrecognized type '$type'.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/IslandoraHierarchicalAccessCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IslandoraHierarchicalAccessCommands extends DrushCommands {
*/
public function __construct(
LUTGeneratorInterface $lut_generator,
EntityTypeManagerInterface $entityTypeManager
EntityTypeManagerInterface $entityTypeManager,
) {
parent::__construct();
$this->lutGenerator = $lut_generator;
Expand Down
2 changes: 1 addition & 1 deletion src/EntityAccessHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function __construct(
EntityStorageInterface $storage,
$column,
$target_column,
array $op_map
array $op_map,
) {
$this->database = $database;
$this->ops = $ops;
Expand Down
2 changes: 1 addition & 1 deletion src/EntityCUDHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __construct(
Connection $database,
LUTGeneratorInterface $generator,
$column,
$operations
$operations,
) {
$this->database = $database;
$this->generator = $generator;
Expand Down
2 changes: 1 addition & 1 deletion src/LUTGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function regenerate(): void {
/**
* {@inheritDoc}
*/
public function generate(EntityInterface $entity = NULL): void {
public function generate(?EntityInterface $entity = NULL): void {
if (count($this->uniqueFileFields()) === 0) {
// Did not find any fields over which to generate the LUT so abort the
// attempt.
Expand Down
2 changes: 1 addition & 1 deletion src/LUTGeneratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public function regenerate(): void;
* LUT will be completely regenerated. If provided, only those rows
* resulting from the given entity will be added to the table.
*/
public function generate(EntityInterface $entity = NULL): void;
public function generate(?EntityInterface $entity = NULL): void;

}
Loading