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) »
  • Custom ACLs vs Contact Search field in top menubar
Pages: [1]

Author Topic: Custom ACLs vs Contact Search field in top menubar  (Read 939 times)

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Custom ACLs vs Contact Search field in top menubar
September 08, 2010, 08:52:34 pm
In 3.x, the contact search field has been moved to the top menu bar, and its visibility appears to depend on the user having access to "edit all contacts" or "view all contacts".

We have a site, upgraded from 2.2, which has users who are restricted by custom ACLs (via hook_civicrm_aclWhereClause()). These users do not have view or edit on all contacts, and consequently do not have the contact search field.

Is there some additional code which needs implementing to make this block and its AJAX callback* work for users without access to all contacts?

It looks like (in CRM_Core_Permission::getPermission()) we might be expected to alter $config->userPermissionClass if we want custom permissioning?

* AJAX callback: civicrm/ajax/rest?className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=navigation&s=b&limit=10&timestamp=1284004131548 etc
@xurizaemon ● www.fuzion.co.nz

michaellenahan

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 0
    • mick.appspot.com
Re: Custom ACLs vs Contact Search field in top menubar
February 03, 2012, 09:15:26 am
Hi there everyone

I'm encountering this exact problem. I have a hook_civicrm_aclWhereClause which works well in restricting contacts for some logged in users.

(In my case it's for a political party, allowing local party membership secretaries to see the members in their local party only.)

However, the quick search box, search... menu item, and contacts menu are missing.

The relevant Drupal role has "access CiviCRM" permission only.

For obvious reasons I can't give the Drupal role "view all contacts" permission (since these people should only view their own local contacts), but if I do give them this permission, the search box and the other things come back.

During my experiments on this, I did find that if I manually created an acl within CiviCRM (/civicrm/acl?reset=1) and gave view rights to a group, and assigned the acl to a CiviCRM role, I get the search box back and it works as expected.

However, I don't want to have to manually create hundreds of acls, roles and groups just for this purpose.

My question then: is there a way to assign the necessary view contacts permission via my drupal module? Is there a way to achieve what I want in code?

Thanks for your help!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Custom ACLs vs Contact Search field in top menubar

This forum was archived on 2017-11-26.