fixed bug with caseworker home page stuff

This commit is contained in:
naomi 2022-07-12 08:44:20 +01:00
parent c03683d819
commit 0f93be7071
2 changed files with 5 additions and 5 deletions

View File

@ -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 * If the user has permission to see all cases, then when the login they are
* redirected to a view of just their own cases. * redirected to the all cases view.
*/ */
function opencase_user_login_form_submit($form, FormStateInterface $form_state) { function opencase_user_login_form_submit($form, FormStateInterface $form_state) {
if (!\Drupal::currentUser()->hasPermission('view published case entities')) { if (Drupal::currentUser()->hasPermission('view published case entities')) {
$form_state->setRedirectUrl(Url::fromRoute('view.cases_by_provider.page_1')); $form_state->setRedirectUrl( Url::fromUserInput('/opencase/cases/all'));
} }
} }

View File

@ -48,7 +48,7 @@ class OpencaseSubscriber implements EventSubscriberInterface {
return $this->currentUserCanSeeAllCases(); return $this->currentUserCanSeeAllCases();
} }
private function currentUserCanSeeAllCases():bool { 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 { private function redirectToAlternativeHomePage(GetResponseEvent $event):void {