2

We are using Civi 5.14 on WordPress 5.1 My client has giving me this request. Can this even be done with Civi? She wants to restrict our volunteers to viewing only contacts within their own state, or reports based on contacts in their own state. Her request is below.

"create log-ins for almost everyone on the affiliates list (Contact/Advocate/Affiliate leader anyway.) Then, arrange so that their access gives them the ability to view ONLY contacts from their state, and have a simple way to download contact info (perhaps several pre-created reports like email/phone only, full mailing info, and "full info" which would hit a few other things like Y/N donor, member, event participation."

2

Seems like CiviCRM ACL might be your answer.

https://docs.civicrm.org/user/en/latest/initial-set-up/permissions-and-access-control/

Native CiviCRM ACLs give more fine grained control, so, for example, you can limit access to view, edit, create, delete and search to :

groups of contacts
a profile (this is a collection of existing and/or custom fields, see "Profiles")
a set of custom fields
events (e.g. a user may access one event, but not others)
| improve this answer | |
  • I already use that to grant permissions to groups of contacts, but in this case the group of contacts will all have the same permissions,k but we need to restrict them even further so one member of that group can't see the same data another member of it can see. – fdarn Aug 19 '19 at 22:06
  • We want the volunteer in Florida to only see contacts with Florida addresses and the volunteer in California to only see contacts with California addresses. – fdarn Aug 19 '19 at 22:09
  • 1
    So make a role for each state, and a smart group for each state (addresses), add an ACL that each role can only access contacts from their state smart group, and then assign your volunteer the role. this way that user can only see contacts from that smart group, which is limited to addresses in a state. – Zachary Aug 20 '19 at 0:55
  • 1
    I created a new ACL Role "Connecticut Volunteers". I assigned that role to a new group. I added one user to that new group. This user is not in any other groups. Then I set that Connecticut Volunteers role to view only data in the Connecticut Contacts group. After saving it, this user still has access to ALL groups, not just the Connecticut contacts group. – fdarn Aug 21 '19 at 15:06
  • fdarn; I just made a test site and verified it worked. Can you ensure that in 'Assign Users' the group selected contains the user that will login, and verify that in 'Manage ACL' the group selected is a smart group that was made to only include addresses from Connecticut (via Advanced search or otherwise). Could you lastly ensure that in your CMS permissions you do not have 'View all Contacts' or 'Edit all Contacts' assigned to the role of the user logging in? – Zachary Aug 21 '19 at 19:46
1

If the standard ACL's are not sufficient, you can add your own using hook_civicrm_aclWhereClause. Basically, you add more SQL "where" clauses to restrict which contacts are accessible. See the documentation for an example.

| improve this answer | |

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.