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 (Moderator: Donald Lobo) »
  • Simple ACLed edit interface
Pages: [1]

Author Topic: Simple ACLed edit interface  (Read 696 times)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Simple ACLed edit interface
July 24, 2012, 07:37:17 am
Hey there,

I want to create an edit screen that is ACLed (i.e. only certain users can edit certain contacts via a custom ACL) and I am wondering whether I can use profiles to do this.

I think I am right in assuming that when you use a profile for a 'Standalone Form or Directory' then that bypasses ACL.  But it isn't clear if that happens for both listing and editing.

Can I define whether a certain profile should be available to edit a certain contact based on the logged in user using a CiviCRM hook? I hope so :)

I'll post the answer here when I know (although you should feel free to answer that question for me as well :) ).

Until then I'll reflect on how complex profiles are and why they are so complex, and how we could make them simpler :) 

Michael
« Last Edit: July 24, 2012, 07:51:44 am by michaelmcandrew »
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

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: Simple ACLed edit interface
July 24, 2012, 10:31:39 am

yes profiles can be permissioned. If you want to do this at an individual profile level, you can use CiviCRM ACL's

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

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Simple ACLed edit interface
August 07, 2012, 01:35:24 pm
Quote
yes profiles can be permissioned
I don't think that answer is specific enough. i know that profiles can be permissioned, but 1) I don't know how that interacts with using a profile for for a 'Standalone Form or Directory', and 2) if profiles will provide something suitable for this use case, which I'll describe in a bit more detail.

A logged in user should only be able to view a certain segment of contacts. They should also be able to edit a few fields core and custom fields for these contacts.  We want to define this with a profile and then say. contact A can use profile X to edit some contacts (which contacts depends on the logged in user). They shouldn't be able to view or edit any other contacts via this profile.

I'm going uncheck the 'Standalone Form or Directory' option, and see what happens when it comes to editing and ACL, etc.

I am going to presume that I need to use hook_civicrm_aclGroup to do this but the documentation and code is so obtuse that I have no idea if this is the right approach. I have tried to solve this in the past / tried to improve the documentation, but cannot get my head around it at all :(

The hook_civicrm_aclGroup documentation makes it sound like you can do just about anything with it "This hook is called when composing the ACL to restrict access to civicrm entities (civicrm groups, profiles and events)" but i have a sneaky feeling this is not true. It would be great if we could get more specific in the documentation about how this hook can be used.

Does anyone know the reason why this ACL appears so complicated and how we can simplify it in this instance?
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Simple ACLed edit interface
August 07, 2012, 07:33:19 pm
Not sure I read the above thoroughly enough before commenting but...

Setting up a Group based ACL and then using a webform-civicrm interface works nicely. It will restrict the contacts returned via an autocomplete to the people they have access to - or you can even sidestep the ACL and just rely on the filter on the webform component to limit who they can access.

and you can limit who access the form by drupal role

any help in your case?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Simple ACLed edit interface
August 26, 2012, 08:31:07 am
Thanks for the input, Peter.  We'll finish this off in the next week or so and I'll post here with how we did it.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Simple ACLed edit interface
August 31, 2012, 05:39:19 am
OK - so continuing on this journey.

I would like to grant a group of users access to edit via a specific profile.  They should not be able to edit via any other profiles.

I am wondering if we can use hook_civicrm_aclGroup to do this. Would be good to discuss before I start - if anyone has experience with this, would be good to chat!

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Simple ACLed edit interface
August 31, 2012, 02:16:17 pm
You don't like the webform approach? if those users had a particular Drupal role, then you can limit who can use the webform to that role
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Simple ACLed edit interface
September 03, 2012, 02:05:21 am
I do quite like the webform approach, but in this instance I'd like to do it via ajax pop up which is built into profiles....
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Simple ACLed edit interface

This forum was archived on 2017-11-26.