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) »
  • restricting events shown to a user to be from his/her physical location?
Pages: [1]

Author Topic: restricting events shown to a user to be from his/her physical location?  (Read 1103 times)

sushilmasti

  • Guest
restricting events shown to a user to be from his/her physical location?
March 22, 2009, 04:49:53 pm
Hi!

We're using CiviCRM for an international non-profit and we really appreciate the hard work and detailed configuration available. (Drupal 6.10 + CiviCrm 2.2)

We have a requirement where the country is broken into multiple chapters - each chapter has a co-ordinator.  The chapter coordinator must be only able to view/administer events that are in his/her chapter.

Event has a custom field called chapter_id
Contact also has a custom field called chapter_id

So we want a user to only see events where his chapter_id = event.chapter_id

We've not been able to figure out how to use hook_civicrm_aclGroup to do this. Is this invoked a user clicks on the main CiviEvent link?

Saw something similar in the post below but did not understand the solution :(

http://forum.civicrm.org/index.php/topic,5828.0.html

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: restricting events shown to a user to be from his/her physical location?
March 22, 2009, 05:41:27 pm
Could you not customise the event types & then use smart groups & acls to permit users to view only certain event types? I can't remember if there's an acl within civi for creating events yet though
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

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: restricting events shown to a user to be from his/her physical location?
March 22, 2009, 06:10:30 pm

eileen: i dont think that will work, the controlling group needs to be a static group

sunil: the acl hook is invoked whenever we need to display a list of events or a view/edit/register for a single event. If you are a php/mysql programmer and need some clarification ping us on IRC. If not, your best bet would be to hire someone from http://civicrm.org/professional/

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

sushilmasti

  • Guest
Re: restricting events shown to a user to be from his/her physical location?
March 26, 2009, 11:19:23 am
Thanks for the replies Eileen and Lobo.

Do you mean hook_aclWhereClause or hook_aclGroup? We used the latter successfully to allow a user to only have permission to see the individual event belonging to his center.

But on the page showing all events we have not been able to filter the events to be the ones having the same location - would this also be in the aclGroup hook?

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: restricting events shown to a user to be from his/her physical location?
March 26, 2009, 12:30:50 pm

can u give me the url for the "showing all events". is it: http://localhost/~lobo/drupal6/civicrm/event/manage?reset=1

most likely a bug in civicrm and we are not making the acl calls there.

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

sushilmasti

  • Guest
Re: restricting events shown to a user to be from his/her physical location?
March 31, 2009, 11:11:18 am
Yes that is the link. We created a custom version of Event.php to solve the problem but controlling it by the acl would be even better :-)

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: restricting events shown to a user to be from his/her physical location?
March 31, 2009, 11:40:45 am

can you post the diff between the two versions

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

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: restricting events shown to a user to be from his/her physical location?
March 31, 2009, 11:50:34 am
can u apply the following patch and see if it does the needful:

Code: [Select]
svn diff CRM/Event/Page/ManageEvent.php
Index: CRM/Event/Page/ManageEvent.php
===================================================================
--- CRM/Event/Page/ManageEvent.php      (revision 20491)
+++ CRM/Event/Page/ManageEvent.php      (working copy)
@@ -379,9 +379,8 @@
             }
         }
 
-        if ( empty( $clauses ) ) {
-            return 1;
-        }
+        require_once 'CRM/Core/Permission.php';
+        $clauses[] = CRM_Core_Permission::eventClause( );
 
         return implode( ' AND ', $clauses );
     }
« Last Edit: March 31, 2009, 12:01:45 pm by Donald 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) »
  • restricting events shown to a user to be from his/her physical location?

This forum was archived on 2017-11-26.