2

My user would like a particular case worker to be prevented from accessing one specific client. At present we're not using ACLs but I implemented one scheme that I could get to work on my test system but not on their system - I have almost given up trying to figure out why. I created a smart group with all clients except the excluded one, and a group with the case worker who could see only this group. Can anyone suggest another way this can be achieved?

  • My suggestion would be something similair to solve it technically. But my gutfeeling is that there are some organizational issues at your client. Why is one particilair case worker not allowed to see one particilair client? What is the reasons behind that and how else could that be solved? My first gutfeeling is that you are trying to solve conflict avoidance behaviour if it is that behaviour that needs to be addressed first before providing a technical solution. – Jaap Jansma - CiviCooP May 31 '18 at 8:00
  • Above is my gutfeeling and I could be completly wrong. But at least it is worth trying to figure what reasoning behind the request is. – Jaap Jansma - CiviCooP May 31 '18 at 8:01
  • The 2 people are related, and I agree that a technical solution is possibly not the best. But I'm still trying to work out a good way to solve this – Andy Clark May 31 '18 at 13:24
3

You could do that with hook_civicrm_aclWhereClause:

  • remove 'view all contacts', 'edit all contacts' for the case worker
  • create an extension implementing hook_civicrm_aclWhereClause eg:

function everyoneexcept_civicrm_aclWhereClause($type, &$tables, $whereTables, &$contactID, &$where) { if ($contactID == 'your_case_worker_id') { $where .= ($where ? ' AND ' : '') . " contact_a.id != 'your_case_worker_relative_id'"; } }

For a one-off case, just hardcode the contact id's for your case worker and their relative.

Caveat - not extensively tested!

  • This is a lifesaver @aidan! I didn't realize that in "vanilla" ACLs, you're controlling both access to the groups AND the contacts in the groups. This technique is perfect if you want to hide contacts in a group, but let users see all the groups. – Jon G - Megaphone Tech Dec 6 '18 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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