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 TO allow only some groups to access activity info (call log, meetings, etc)
Pages: [1]

Author Topic: HOW TO allow only some groups to access activity info (call log, meetings, etc)  (Read 2130 times)

kncosta

  • I’m new here
  • *
  • Posts: 9
  • Karma: 1
HOW TO allow only some groups to access activity info (call log, meetings, etc)
June 03, 2008, 06:09:28 pm
Hi all, I'm looking for help from this community to see if the problem I'm facing is similar to what you folks may have experienced as well.

My understanding is Contact module is core to a CiviCRM install and the idea is that most information from contact view would be available to most users who have permission to view contacts. I'm trying to setup only some groups to have access to some tabs from Contact Page like Relationships and Activities (call log, meetings, compose email, etc). I don't know if it is possible to do this through profiles.

For example, let's say I call one of my members and s/he complains about a customer representative, or maybe there is a suggestion or even an issue that should be treated as confidential. Do you know if there is a way to set the permission so only some people (like one supervisor from customer service or a psychologist, priest, etc) would have full visibility to the information entered/stored on these forms?

Thanks in advance!

regards,
Kleber

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: HOW TO allow only some groups to access activity info (call log, meetings, e
June 04, 2008, 12:28:49 am
I don't think currently, it is possible to do that. You cannot hide tabs based on permissions. You can use preferences to remove those tabs for all users.

HTH
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: HOW TO allow only some groups to access activity info (call log, meetings, e
June 04, 2008, 08:40:35 am
I've added a "feature candidate" for this on the 2.2 roadmap. The current implementation for controlling access to these contact "tabs" is a bit inconsistent as you can hide "component-related" tabs (at least in Drupal installs) by modifying the "access CiviContribute", "access CiviEvent", etc. permissions. However - you can't control Activities, Relationships, Groups, Tags and Notes as of yet.
Protect your investment in CiviCRM by  becoming a Member!

perryl7

  • Guest
Re: HOW TO allow only some groups to access activity info (call log, meetings, etc)
October 08, 2008, 07:12:17 pm
Does anyone know how I might be able to adapt the code to handle something similar or which area of code I might look at? It already hides the pledges and contribution tabs when I am logged in on as a normal user, but I can see them all when logged in as an administrator. It seems like I should be able to do the same for some of the other 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: HOW TO allow only some groups to access activity info (call log, meetings, etc)
October 08, 2008, 08:29:51 pm

you can modify the code at:

CRM/Contact/Page/View/Tabbed.php, line 278 or so

u'll need to unset the array entries for the tabs you dont want the user to see. You might be able to do this earlier on in the process also

ping us on IRC if u need help or have any questions (http://embed.mibbit.com/?server=irc.freenode.net&channel=%23civicrm&forcePrompt=true)

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

perryl7

  • Guest
Re: HOW TO allow only some groups to access activity info (call log, meetings, etc)
October 10, 2008, 06:46:06 pm
Thanks for the info. I'll give it a shot and see what I can come up with.

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: HOW TO allow only some groups to access activity info (call log, meetings, etc)
October 20, 2008, 01:32:05 am
In CRM_Contact_Page_View_Tabbed::view(), we call hook_civicrm_links() to bring in other tabs that may be produced by a module.

One solution here would be to key the returned array, and allow for modules to remove tabs via the same hook.

This allows module authors to cleanly remove tabs using an external system (eg: we have a custom data tab which should only be visible to site administrators).

Currently, if an external module adds a separate tab with a matching ID, Dōjō throws an exception: "Error: Tried to register widget with id==custom_19 but that id is already registered".

I've implemented part of this, namely the ability to remove tabs, but it's still possible for a user who has access the right "access all custom data" to access the custom data group URL directly and edit the data.

I'd be interested to look at ways in which module authors can interact with CiviCRM to add custom permissions hooks to restrict access to URLs.

In Drupal space, the same hook provides the facility to add/remove menu entries (including subtabs) and the permissions to access the generated URL.

I think the implementation attached below could be cleaned up (eg, assigning blank params to remove an entry is a bit messy), but it functions OK.
« Last Edit: October 20, 2008, 01:42:17 am by xurizaemon »
@xurizaemon ● www.fuzion.co.nz

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 TO allow only some groups to access activity info (call log, meetings, etc)
October 20, 2008, 08:22:14 am

hey chris:

1. In 2.1 there are menu hooks that you can override the default civicrm menu entries. I suspect you can also override the permissions with the menu hooks

2. Am thinking of a good way of allowing the hooks to "remove" a tab (in general all our hooks (and most drupal hooks)) are additive. maybe just another hook to remove entries might be a good alternative (keeps interface simpler etc)

3. We have not percolated permissioning down to the tab level as yet. I dont have an elegant solution to this other than injecting your own permissioning code via step 1

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

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: HOW TO allow only some groups to access activity info (call log, meetings, etc)
October 20, 2008, 03:12:33 pm
Drupal's hooks are additive, but allow you to "add" entries over the top of existing entries, and I think this is a good model (maybe because it's familiar, but also because it prevents having a second pass through a hook function).

To remove an existing entry,

Code: [Select]
function mymodule_menu($may_cache) {
  $items[] = array(
    'path'     => 'path/of/existing/entry',            // path to remove from menu
    'title'    => 'This text will not appear anyway',  // label won't be visible
    'callback' => 'drupal_not_found',                  // return drupal 404 for this path
    'type'     => MENU_CALLBACK,                       // don't show an entry in the menus
  ) ;
  return $items ;
}
@xurizaemon ● www.fuzion.co.nz

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • HOW TO allow only some groups to access activity info (call log, meetings, etc)

This forum was archived on 2017-11-26.