Skip to content

Commit

Permalink
Move more explicitly to existence check.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey committed Feb 20, 2024
1 parent 84dd7a5 commit 3896ae6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Access/QueryTagger.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ public function tagAccess(SelectInterface $query, string $type) : void {
// No embargo.
$embargo = $this->database->select('embargo', 'ee');
$embargo->fields('ee', ['embargoed_node']);
$exist_or->condition("existence_node.nid", $embargo, 'NOT IN');
$embargo->where('existence_node.nid = ee.embargoed_node');
$exist_or->notExists($embargo);

// Embargoed (and allowed).
$accessible_embargoes = $this->buildAccessibleEmbargoesQuery(match($type) {
'file', 'media' => EmbargoInterface::EMBARGO_TYPE_FILE,
'node' => EmbargoInterface::EMBARGO_TYPE_NODE,
});
$exist_or->condition("existence_node.nid", $accessible_embargoes, 'IN');
$accessible_embargoes->where('existence_node.nid = e.embargoed_node');
$exist_or->exists($accessible_embargoes);

$existence->condition($exist_or);

Expand Down

0 comments on commit 3896ae6

Please sign in to comment.