CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Groups and the ACL
Pages: [1] 2

Author Topic: Groups and the ACL  (Read 2238 times)

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Groups and the ACL
July 27, 2010, 01:57:18 pm
I may be beating a dead horse here, but I though I would ask.

One of our clients has several data entry staff who have limited access to edit records, ideally the summary page and relationships, maybe tags but that's pushing it honestly.  There are about 50 of these staff so they tend to get different levels of training and have vastly differing levels of attention to detail (some are temps who are there 1-4 days).  As such we need to tighten down on what they see.

We have a series of custom fields that hols particularly sensitive data, we figured that we would use the CiviCRM ACL to hide those fields from the data entry staff.  We ran into one major hole for which we have a couple less than perfect ideas for but I wanted to see if I'm missing something obvious.  We're using Drupal 6 & CiviCRM 3.1.5 with the usual LAMP stack (PHP 5.2.10, MYSQL 5.1, Apache 2.2 etc...)  and are assuming we need to turn of the 'access all custom data' permission for the data entry staff and controlling what fields they can see with ACLs and groups.

Problem: We don't want data entry staff to add members (or themselves) to groups as they can simply add themselves to a group that can edit/view the fields we want to hide from them (and yes before you ask they have done this on a couple occasions).  You receive permission to edit groups if you can edit by way of the the Drupal "edit all contacts" permission or if you have permission to edit a record granted by the CiviCRM ACL.

We thought about writing hooks to remove the staff personal records from any group that they have permission to edit therefore meaning they can't grant permission to themselves, but that still means they can give permission to members to see the data (which isn't a big deal as members can't access CiviCRM anyway).  This seemed a weak solution, but one you could do with hooks/apis meaning it won't likely break with upgrades.

any ideas are welcome

http://www.rootyhollow.com

TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
Re: Groups and the ACL
July 27, 2010, 02:16:00 pm
We've faced a similar problem with a similar solution.  We're using hook_civicrm_aclGroup to simply screen out all ACL groups from users that we decide should not have that access.  Of course, this relies on not giving those users "edit all contacts", which would cause that hook to be skipped over.

- TM
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

roberto.salvo

  • Guest
Re: Groups and the ACL
July 28, 2010, 02:40:13 am
Hi Folks,
I have the same need, could you say me where I can find that hook "hook_civicrm_aclGroup"? and how to use it?

Thank You in advance

Rob

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Groups and the ACL
July 28, 2010, 02:43:00 am
Rob,

Quote
I have the same need, could you say me where I can find that hook "hook_civicrm_aclGroup"? and how to use it?
Check examples in below file.
http://svn.civicrm.org/civicrm/branches/v3.2/drupal/civitest.module.sample

Hth

Kurund
Found this reply helpful? Support CiviCRM

roberto.salvo

  • Guest
Re: Groups and the ACL
July 28, 2010, 03:08:36 am
Thank for your quick reply ;)
However I'm very new to civicrm and i don't know yet how to use that file, Could you provide me more info?

thank you

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Groups and the ACL
July 28, 2010, 03:16:54 am
Basically you need to implement hooks, check http://en.flossmanuals.net/CiviCRM/DevelopHooks

Kurund
Found this reply helpful? Support CiviCRM

roberto.salvo

  • Guest
Re: Groups and the ACL
July 28, 2010, 03:25:16 am
 :) ok thank you, i will try and let you know

Thank You

Rob

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Groups and the ACL
August 04, 2010, 04:00:33 pm
Yes we have a similar need. It seems if you grant Edit All Contacts then the Edit Groups permission doesn't matter. Unless I'm misunderstanding what Edit Groups means. Also as noted granting Edit All Contacts would override any aclGroup hook. And we don't want to hide any groups, just who can edit membership in a group.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Groups and the ACL
August 04, 2010, 04:07:29 pm
Hi,

We have implemented a system whereby we give people permissions based on a custom field. The custom field is in a tab of it's own and we also use a hook to hide the custom tab based on permissions.

ie. each contact is in a 'City' field. We also have a separate checkbox field 'view cities' and if the 'Wellington' box is checked for a given user they can view contacts in Wellington. The check box that sets the permission can be restricted using drupal permissions. I can share the code but will need to find time to sort it for sharing.

Note that ACLs should be seen as 'best effort' All contact view ACLs can be circumvented by any user with 'Access CiviCRM' permission using the REST URLS
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: Groups and the ACL
August 05, 2010, 05:40:22 am
Quote
Note that ACLs should be seen as 'best effort' All contact view ACLs can be circumvented by any user with 'Access CiviCRM' permission using the REST URLS

ouch that hurts

Eileen I would like to see the code when you get a chance
http://www.rootyhollow.com

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Groups and the ACL
August 05, 2010, 04:28:38 pm
Hi Jim,

I'll try to get it sorted for you soon - the code is based on Chris's code which is here in a basic form - the code on the wiki gives out permissions based on custom fields (actually I think it can be core fields too)

http://wiki.civicrm.org/confluence/display/CRMDOC21/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmaclWhereClause

The additions that we are using are around hiding the permissions tabs based on drupal permissions & on using it in a multisite context
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: Groups and the ACL
August 06, 2010, 05:17:41 am
Yea

I'be done a good bit of hiding tabs based on characteristics of the record and/or the user viewing it, but I usually user hook_civicrm_tabs for that kind of thing.
http://www.rootyhollow.com

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Groups and the ACL
August 06, 2010, 04:02:10 pm
Yeah - that's what I mean about additions - the code I've linked to is the ACL stuff & we have some extra code to hide the tabs
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

jalama

  • I post frequently
  • ***
  • Posts: 176
  • Karma: 22
    • Rooty Hollow LLC
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6 and 7
  • MySQL version: 5.1
  • PHP version: 5.2.5 and 5.3
Re: Groups and the ACL
August 09, 2010, 05:52:39 am
So I was poking around 3.1 for a client and I noticed that is you have permission to edit a contact through relationships you cannot add that contact to a group, even if you have edit groups permission in Drupal.

Makes me wonder how how it would be to update the permissions to either leverage the edit groups permissions to control who can add groups to a contact or add another permission like "edit group membership". That controls who can edit a groups membership.  I'm guessing you would have to be delicate about still allowing profile sign-ups to add people to groups and anyone who was going to import people into a particular group would have to have this permission, etc...

What else would we have to think through?
http://www.rootyhollow.com

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Groups and the ACL
August 09, 2010, 06:55:28 am

groups are exposed to those users who have the group ACLs (since thats the other permissioning mechanism). If i'm not mistaken, the "Edit Groups" permission is just the ability to create/update/delete new groups

however u can expose the public groups to a profile, and hence the permissioned related contact can add/remove the other contact via that mechanism

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Groups and the ACL

This forum was archived on 2017-11-26.