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 Profiles (Moderator: Dave Greenberg) »
  • limiting access to the relationship tab
Pages: [1]

Author Topic: limiting access to the relationship tab  (Read 1048 times)

rayk_sland

  • Guest
limiting access to the relationship tab
September 27, 2010, 08:22:12 am
Is there a way to limit access to the relationships tab? or to put the question another way, it seems simple enough to block access to the CiviContribute, but we'd like to block donor relations people from knowing anything about a relationship of a donor to a client. How would we do that? Relationships seems to be enabled globally or not at all.

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: limiting access to the relationship tab
September 27, 2010, 09:21:13 am

you should be able get around this limitation in a hook function. You can hide the relationship tab by implementing the hook_civicrm_tabs hook. If you want to make it more secure, you can also implement hook_civicrm_pageRun and hook_civicrm_buildForm and check that the person viewing/editing the relationship page has the necessary permission (which u'll neeed to add via a drupal 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

rayk_sland

  • Guest
Re: limiting access to the relationship tab
September 27, 2010, 03:52:51 pm
That looks really cool but somewhat byzantine to me because this is my first civicrm install and now there's drupal, too. (I had to install it with the upgrade from 3.1.x standalone) Is there a step by step howto on implementing hook functions as acls?

rayk_sland

  • Guest
Re: limiting access to the relationship tab
November 18, 2010, 10:06:29 am
Okay, getting down to it.

I've created a sites/all/modules/tabaccess directory
I populated it with a tabaccess.info file and a tabaccess.module file

the tabaccess.info Contains
Quote
name = Tab Access Module
description = Limit Who Can See Tabs
dependencies[] = civicrm
package = CiviCRM
core = 6.x
version = 3.2

the tabaccess.module contains (the sample code from hook_civicrm_tabs all commented out)

Quote
function tabaccess_civicrm_tabs( &$tabs, $contactID ) {

    // unset the contribition tab, i.e. remove it from the page
    // unset( $tabs[1] );

    // let's add a new "contribution" tab with a different name and put it last
    // this is just a demo, in the real world, you would create a url which would
    // return an html snippet etc.
    // $url = CRM_Utils_System::url( 'civicrm/contact/view/contribution',
    //                               "reset=1&snippet=1&force=1&cid=$contactID" );
    // $tabs[] = array( 'id'    => 'mySupercoolTab',
    //                  'url'   => $url,
    //                  'title' => 'Contribution Tab Renamed',
    //                 'weight' => 300 );
}


Am I on the right track with this?

from the sample code it looks like if I can test for the right group, I can remove the desired tab by using
Quote
unset( $tabs[1] );
assuming that I select the right number in the braces after $tabs.

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: limiting access to the relationship tab
November 18, 2010, 12:15:20 pm

yes. but you might want to unset something based on the title rather than a fixed number (which might change)

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

rayk_sland

  • Guest
Re: limiting access to the relationship tab
November 18, 2010, 01:04:39 pm
do you have any suggestions as to how to test for group or role or whatever?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • limiting access to the relationship tab

This forum was archived on 2017-11-26.