2

I've got a multi-site with the following roles in Drupal:

  • Site admin (full access)
  • Local admin (can view all contacts)
  • Case Manager (can view all Cases)
  • Staff (using ACLs, can view site-specific contacts and no Cases)

We want to restrict the Case Managers so that they can only see the Cases on their own site, even if they also have 'Local admin' (view all contacts).

I've only managed to implement so far by adding all Case Managers as 'Coordinators' to every Case in their local site, so that the 'View my Cases' enables them to see the local Cases.

This is fine, however I cannot work out how Case Managers can then add more than one Case Coordinator for new Cases.

  • Using the Drupal webform, I can only specify a single contact for Case Coordinator (regardless of permissions)
  • In the normal Case Dashboard, only people with 'Site Admin' (i.e. full access) have the ability to add more Roles to a Case
  • In the Case Type set-up, it only allows one of each relationship type for the default set up.

Is there a way to enable staff to either see all Cases for their local instance only or to enable them to manually add more than one Case Coordinator so that the three staff can see all Cases for their local site?

1 Answer 1

1

Technically it's the permission "access all cases and activities" that can add roles on Manage Case but I guess that's the same as "site admin"/"full access" in your setup. The reason seems to be to avoid a loophole where access to cases could be granted that shouldn't be (see https://civicrm.stackexchange.com/a/33409/181).

Anyway what you might be able to do is tag or group the people who should all be case managers for a given local site, and then using hook_postProcess or hook_post add some code that automatically adds those roles when a new case is created for people who have the same tag/group as the case creator, i.e.

loop for each person with the same tag/group as the logged in user:
civicrm_api3('Relationship', 'create', [
  'contact_id_a' => 123, // client id
  'contact_id_b' => 194, // other person's id
  'relationship_type_id' => 9, // Case Coordinator is
  'case_id' => 12345,
]);
2
  • I've also noticed that users without 'access all cases' cannot see resolved/closed cases - can this be adapted in a similar way? Nov 6, 2019 at 15:22
  • That's probably related to some ongoing known issues with relationships when a case closes. There's a couple lab tickets / stalled PRs still open. But you could do a local customization, just note it also currently affects what appears on the case dashboard when you change the behavior. This is one reason it's hard to fix because changing one thing changes three other things.
    – Demerit
    Nov 6, 2019 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.