diff --git a/opencase.module b/opencase.module index 5bd8a59..22a5fd2 100644 --- a/opencase.module +++ b/opencase.module @@ -20,12 +20,12 @@ function opencase_form_user_login_form_alter(&$form, FormStateInterface $form_st } /** - * If the user does not have permissions to see all cases, then when the login they are - * redirected to a view of just their own cases. + * If the user has permission to see all cases, then when the login they are + * redirected to the all cases view. */ function opencase_user_login_form_submit($form, FormStateInterface $form_state) { - if (!\Drupal::currentUser()->hasPermission('view published case entities')) { - $form_state->setRedirectUrl(Url::fromRoute('view.cases_by_provider.page_1')); + if (Drupal::currentUser()->hasPermission('view published case entities')) { + $form_state->setRedirectUrl( Url::fromUserInput('/opencase/cases/all')); } } diff --git a/src/EventSubscriber/OpencaseSubscriber.php b/src/EventSubscriber/OpencaseSubscriber.php index 5b349cc..1de1f3d 100644 --- a/src/EventSubscriber/OpencaseSubscriber.php +++ b/src/EventSubscriber/OpencaseSubscriber.php @@ -48,7 +48,7 @@ class OpencaseSubscriber implements EventSubscriberInterface { return $this->currentUserCanSeeAllCases(); } private function currentUserCanSeeAllCases():bool { - return \Drupal::currentUser()->hasPermission('view all published case entities'); + return \Drupal::currentUser()->hasPermission('view published case entities'); } private function redirectToAlternativeHomePage(GetResponseEvent $event):void {