Skip to content

Commit

Permalink
POMP-166 Update queries w/ accessCheck() call
Browse files Browse the repository at this point in the history
  • Loading branch information
camilocodes committed Oct 25, 2023
1 parent c0cebbe commit 25f1a2d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions custom/modules/address/address.module
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ function address_preprocess_node__address(&$variables) {
$nid = $address_node->id();
// Query for parent ceremony.
$ceremony_q = \Drupal::entityQuery('node')
->condition('type', 'graduation_ceremony')
->condition('field_addresses', $nid)
->execute();
->condition('type', 'graduation_ceremony')
->condition('field_addresses', $nid)
->accesscheck(true)
->execute();

// Get ceremony id.
$ceremony_id = $ceremony_q ? reset($ceremony_q) : NULL;
Expand Down
4 changes: 4 additions & 0 deletions custom/modules/award/award.module
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function award_preprocess_node__award(&$variables) {
$ceremony_q = \Drupal::entityQuery('node')
->condition('type', 'graduation_ceremony')
->condition('field_awards', $nid)
->accesscheck(true)
->execute();

// Get ceremony id.
Expand Down Expand Up @@ -109,6 +110,7 @@ function award_form_node_award_form_alter(&$form, $form_state, $form_id) {
// Recover term ids for all award types.
$tids = \Drupal::entityQuery('taxonomy_term')
->condition('vid', 'award_type')
->accesscheck(true)
->execute();

// Build associative array with name => tid for award types.
Expand Down Expand Up @@ -183,6 +185,7 @@ function award_form_node_award_edit_form_alter(&$form, $form_state, $form_id) {
// Recover term ids for all award types.
$tids = \Drupal::entityQuery('taxonomy_term')
->condition('vid', 'award_type')
->accesscheck(true)
->execute();

// Build associative array with name => tid for award types.
Expand Down Expand Up @@ -259,6 +262,7 @@ function award_inline_entity_form_entity_form_alter(&$entity_form, $form_state)
// Recover term ids for all award types.
$tids = \Drupal::entityQuery('taxonomy_term')
->condition('vid', 'award_type')
->accesscheck(true)
->execute();

// Build associative array with name => tid for award types.
Expand Down
2 changes: 2 additions & 0 deletions custom/modules/graduations_scripts/scripts/upd_terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
$found = \Drupal::entityQuery('taxonomy_term')
->condition('vid', 'honorary_degree')
->condition('name', $honorary_degree)
->accesscheck(true)
->execute();

if ($found) {
Expand Down Expand Up @@ -238,6 +239,7 @@ function add_terms($vid, array $terms) {
$found = \Drupal::entityQuery('taxonomy_term')
->condition('vid', $vid)
->condition('name', $term)
->accesscheck(true)
->execute();

if (!$found) {
Expand Down

0 comments on commit 25f1a2d

Please sign in to comment.