From 892a7ae35b7d596f352dec198e8f6a4a1494e7a0 Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 26 Aug 2021 19:10:05 +0100 Subject: [PATCH] Commented out case access stuff; need to re-add that using relation entities --- modules/opencase_cases/opencase_cases.module | 52 ++++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/modules/opencase_cases/opencase_cases.module b/modules/opencase_cases/opencase_cases.module index bf0837b..cd8ab31 100644 --- a/modules/opencase_cases/opencase_cases.module +++ b/modules/opencase_cases/opencase_cases.module @@ -121,32 +121,32 @@ function opencase_cases_theme_suggestions_oc_case(array $variables) { return $suggestions; } -function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) { - if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_case') { - $query->addTag('oc_case_access'); - } - if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_activity') { - $query->addTag('oc_activity_access'); - } -} - -function opencase_query_oc_case_access_alter($query) { - if (\Drupal::currentUser()->hasPermission('view published case entities')) { - return; - } - $linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser()); - $query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_case_field_data.id'); - $query->condition('access_filter.actors_involved_target_id', $linked_actor_id); -} - -function opencase_query_oc_activity_access_alter($query) { - if (\Drupal::currentUser()->hasPermission('view published case entities')) { - return; - } - $linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser()); - $query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_activity_field_data.oc_case'); - $query->condition('access_filter.actors_involved_target_id', $linked_actor_id); -} +//function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) { +// if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_case') { +// $query->addTag('oc_case_access'); +// } +// if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_activity') { +// $query->addTag('oc_activity_access'); +// } +//} +// +//function opencase_query_oc_case_access_alter($query) { +// if (\Drupal::currentUser()->hasPermission('view published case entities')) { +// return; +// } +// $linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser()); +// $query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_case_field_data.id'); +// $query->condition('access_filter.actors_involved_target_id', $linked_actor_id); +//} +// +//function opencase_query_oc_activity_access_alter($query) { +// if (\Drupal::currentUser()->hasPermission('view published case entities')) { +// return; +// } +// $linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser()); +// $query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_activity_field_data.oc_case'); +// $query->condition('access_filter.actors_involved_target_id', $linked_actor_id); +//} /** * Implements hook_theme_suggestions_HOOK().