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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Restrict access to contacts with same relationship
Pages: [1]

Author Topic: Restrict access to contacts with same relationship  (Read 660 times)

andersiversen

  • I post occasionally
  • **
  • Posts: 76
  • Karma: 1
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.26
  • MySQL version: 5.5.32
  • PHP version: 5.3.10
Restrict access to contacts with same relationship
August 09, 2011, 04:55:16 pm
Hi I want to do something similar as rule two in this case (short example - it's a good read):
http://wiki.civicrm.org/confluence/display/CRMDOC40/United+States+National+Committee+for+UN+Women

In my case I have schools instead of chapters.
I have aprrox. 200 schools, and each student in the system have a student-school relationship (schools are organizations, students are individuals).
There will be an appointed admin (a student) on each school, who needs to be able to view and edit the other students from the admin's own school.

Now instead of making 200 groups, one for each school, and assign the admin to thee group corresponding to her relationship, I would like to make just one group, say "schooladmins". Students who are placed in this group then get their edit rights based on their student-school relationship.

How would I go about doing that? Is it "easy" to do with hooks, or is it already possible in Civicrm? I would love if it was possible with ACL's but I don't see/get it.

Best regards
/Anders:)

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: Restrict access to contacts with same relationship
August 09, 2011, 06:31:29 pm

Yes, this should be doable with the acl hooks:

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

Basically u'll need to add a query clause, which finds the school that the logged in user is an "admin of" and then include all the students who have a "student of relationship with the school. The example on the wiki will help you get started.

Ping us on IRC if u need any help with the code

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]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Restrict access to contacts with same relationship

This forum was archived on 2017-11-26.