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) »
  • aclWhere hook - when the GUI also has ACLs
Pages: [1]

Author Topic: aclWhere hook - when the GUI also has ACLs  (Read 576 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
aclWhere hook - when the GUI also has ACLs
June 25, 2013, 12:54:08 am
I recently hit a situation where there was a UI configured ACL and a hook ACL whereClause granting permissions to a person.

It seems the hook example doesn't cover this & assumes the ACL replaces the existing permission. This isn't hugely consistent with the way ACLs are applied - ie. you have permission to see no-one. Then you get to see anyone that any of your  ACLs gives you permission to see.


http://wiki.civicrm.org/confluence/display/CRMDOC43/hook_civicrm_aclWhereClause

I wound up using this logic
Code: [Select]
  if(!empty($where)){
    $originalWhere = $where;
  }
  $clause = 'contact_id IN (1,2,3)';
  $where = implode(' OR ', $clause);
  if($originalWhere){
    $where = "( $originalWhere OR $where )";
  }

I had expected that this wouldn't need to be repeated in every implementation - but perhaps the only gap is documenting the possible logic options (how to code for 'AND', 'OR' & 'Instead').
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • aclWhere hook - when the GUI also has ACLs

This forum was archived on 2017-11-26.