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) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • How would I use ACL to lock Contact records unless a relationship exists?
Pages: [1]

Author Topic: How would I use ACL to lock Contact records unless a relationship exists?  (Read 917 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
How would I use ACL to lock Contact records unless a relationship exists?
July 03, 2011, 10:55:52 pm
I have a situation where there are about 100 Drupal Users.  We'd like to give User X the ability to view and edit Contact Y in CiviCRM only if the Contact X has a "relationship type 1" with Contact Y. 

I know this could be possible by making 100 smart groups with relationship criteria and 100 ACLs to use those 100 smart groups --- but that is very cumbersome.  We would like to make, for lack of a better term a "global ACL rule" that locks any Contact from seeing another Contact unless the specified relationship type exists.

This rule would be ignored for users with an Administrator role.

Is this possible?  Thanks for your thoughts. 

 :)  :) :)
« Last Edit: July 03, 2011, 10:59:49 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

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: How would I use ACL to lock Contact records unless a relationship exists?
July 04, 2011, 12:13:07 am

any reason you are not using "permissioned" relationships via profile? basically if u checkbox the "contact X can edit contact Y", then you can expose a profile with Y's info that X can edit

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

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: How would I use ACL to lock Contact records unless a relationship exists?
July 04, 2011, 04:04:08 am
i am guessing this about editing more than the core Contact fields?
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

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: How would I use ACL to lock Contact records unless a relationship exists?
July 04, 2011, 04:06:43 am
also fwiw the OG synch makes for making ACL groups real easy - so if User X had his own OG then he would only be able to access user Y's civi record if/when User Y 'joins' User X's group - and from memory there is a Drupal Module to give each user their own OG - just a random thought from someone who ends up using OG for more than is good for his own health.  ::)
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

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: How would I use ACL to lock Contact records unless a relationship exists?
July 04, 2011, 12:03:56 pm
@lobo: I have a lot relationships that are not permissioned but I could run a SQL script to change them, that's no problem.   If you could walk me through the workflow please, let me give you the big picture.

once I had the permissioned relationship, I would need to
    * show each user a list of contacts with whom they have a relationship  (drupal view?)
    * allow the users to edit contacts with whom they have a relationship
    * allow users to add activities to the contacts with whom they have a relationship

Furthermore, I would need to give the users the ability to:
    * create new contacts, with whom the permissioned relationship will be established automatically ( i imagine i'd need to have a custom module that uses relationship hooks and post_process hooks on profile submit here)

And restrict users from viewing any details of any contact with whom they do not have a relationship ( this is the medical field, so security is very important)

Could I do all that with a profile?


I'm a little over my head here, so some guidance is VERY appreciated, and I know I may have to punt some of this stuff to webaccess.


« Last Edit: July 04, 2011, 12:08:56 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: How would I use ACL to lock Contact records unless a relationship exists?
July 04, 2011, 12:07:44 pm
@petenz OG is probably not what they want here, I just need editing of contacts and creating new activities for those contacts.  thanks anyway though
Try CiviTeacher: the online video tutorial CiviCRM learning library.

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: How would I use ACL to lock Contact records unless a relationship exists?
July 04, 2011, 12:34:05 pm

Quote from: Stoob on July 04, 2011, 12:03:56 pm
    * show each user a list of contacts with whom they have a relationship  (drupal view?)
    * allow the users to edit contacts with whom they have a relationship

The users that they can edit via their permissioned relationship appears in the User Dashboard. Not sure how easy it is to do in Views (its a slightly complex query), but you can potentially use the code from the user dashboard and create the page

q=civicrm/profile/edit?reset=1&gid=ProfileID&id=relatedContactID

will automatically work when the user is logged in for all profiles

Quote from: Stoob on July 04, 2011, 12:03:56 pm
    * allow users to add activities to the contacts with whom they have a relationship

This will need to be custom code implemented in a custom module. For the school project (and also the ARMS project), we realized its a lot easier to pre-create the activities and allow people to edit the activities that they are connected to

Quote from: Stoob on July 04, 2011, 12:03:56 pm
Furthermore, I would need to give the users the ability to:
    * create new contacts, with whom the permissioned relationship will be established automatically ( i imagine i'd need to have a custom module that uses relationship hooks and post_process hooks on profile submit here)

yes, this is relatively easy and can be implemented in the above module

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

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: How would I use ACL to lock Contact records unless a relationship exists?
July 05, 2011, 10:40:22 am
thanks so much for the help.  I will work with dashboard and see how it goes.

Could you clarify what you mean by this?
Quote
we realized its a lot easier to pre-create the activities and allow people to edit the activities that they are connected to

In my situation, each month a user will create a new activity for each contact they are related to.  This activity will have a duration, a special type "client visit", and a couple custom fields.    After the activity is created, the user should not need to edit the activity again, and if they do, an administrator could help them do it.

Try CiviTeacher: the online video tutorial CiviCRM learning library.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • How would I use ACL to lock Contact records unless a relationship exists?

This forum was archived on 2017-11-26.