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 CiviCase (Moderator: Dave Greenberg) »
  • Permissions to create new case - basic question
Pages: [1]

Author Topic: Permissions to create new case - basic question  (Read 1306 times)

Leo

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
Permissions to create new case - basic question
September 12, 2010, 02:49:30 am
Hi,

I'm trying to set up a fairly basic civicase system, with two user types. A case manager (who can create and then manage just those cases) and a senior manager (who can view and manage all cases). I'm using Drupal so that seemed fairly straightforward to do, I've created two user roles and given the 'manage my own cases' and 'manage all cases' permissions respectively to them.

Everything seems fine, except I can't seem to find a way to allow the 'case managers' to create new cases. I don't get any errors, I just can't seem to find any way to allow someone to create a new case, without giving them the 'manage all cases' permissions.

I'm probably missing something obvious, but I've reinstalled both Drupal and civicrm from scratch. I've not made any access control changes in civicrm, I'm just using the drupal role permissions. I've followed the 'enabling civicase' instructions and 'planning' section of the guide to the letter, but no luck.

Searching the forums, etc. hasn't helped me work this out. Am I just misunderstanding the required permissions to create a case, or is this a bug?

Cheers

Leo

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Permissions to create new case - basic question
September 13, 2010, 06:53:20 am
It does seem to be that way. You need "access all cases" to create new cases, and then that person has to assign the "case manager" a role in the case for them to get access to it.

I don't remember exactly when the my/all permission split was introduced. Might have been specific to NYSS?

Leo

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
Re: Permissions to create new case - basic question
September 13, 2010, 02:51:12 pm
Thanks,

At least I know it's not something I've done wrong. If that's the case, then the 'Understanding CiviCRM' book will need amending. http://en.flossmanuals.net/CiviCRM/CiviCasePlanning as it does say that 'Access my cases and activities' permission allows someone to create a case. What's the most helpful way of me doing that? I'd like to suggest a change to someone, rather than just edit the text (which looks like being possible).

Declaring my lack of coding experience up front...
I'm looking to see a way of getting that behaviour, after a bit of poking around I think I've identified the three changes that would be needed.

1) change the permissions for the 'Add new case' action
2) change the visibility of the 'add case to contact' on the contact summary page
3) change the visibility of the 'add new case' to the shortcuts menu in the sidebar (I'm using Drupal, so may be different in Joomla sidebar and I haven't checked). I've left the requirement for the user to have 'add new contacts' permission, but not sure why that is required to add a case.

This must be behaviour that a few other people would want, so I've attached a patch, based on v3.2.3. It seems to work for me, but be grateful if anyone with a bit more knowledge would take a glance. Or point out a way of doing this without changing the core files!

[Edit - I've added the diff inline as well]

Code: [Select]
diff -Naur civicrm/CRM/Case/Form/Case.php civicrm_mod/CRM/Case/Form/Case.php
--- civicrm/CRM/Case/Form/Case.php 2010-09-06 15:36:32.000000000 +0100
+++ civicrm_mod/CRM/Case/Form/Case.php 2010-09-13 22:03:59.000000000 +0100
@@ -131,7 +131,7 @@
             CRM_Core_Error::fatal( ts( 'You are not authorized to access this page.' ) );
         }
         if ( ($this->_action & CRM_Core_Action::ADD) &&
-             !CRM_Core_Permission::check( 'access all cases and activities' ) ) {
+             !CRM_Core_Permission::check( 'access my cases and activities' ) ) {
             CRM_Core_Error::fatal( ts( 'You are not authorized to access this page.' ) );
         }
         
diff -Naur civicrm/CRM/Case/Info.php civicrm_mod/CRM/Case/Info.php
--- civicrm/CRM/Case/Info.php 2010-08-09 15:08:21.000000000 +0100
+++ civicrm_mod/CRM/Case/Info.php 2010-09-13 22:04:41.000000000 +0100
@@ -94,7 +94,7 @@
     
     // add shortcut to Create New
     public function creatNewShortcut( &$shortCuts ) {
-        if ( CRM_Core_Permission::check('access all cases and activities') &&
+        if ( CRM_Core_Permission::check('access my cases and activities') &&
              CRM_Core_Permission::check('add contacts') ) {
             require_once 'CRM/Core/OptionGroup.php';
             $atype = CRM_Core_OptionGroup::getValue('activity_type',
diff -Naur civicrm/CRM/Contact/BAO/Contact.php civicrm_mod/CRM/Contact/BAO/Contact.php
--- civicrm/CRM/Contact/BAO/Contact.php 2010-09-07 11:15:49.000000000 +0100
+++ civicrm_mod/CRM/Contact/BAO/Contact.php 2010-09-13 22:05:37.000000000 +0100
@@ -2352,7 +2352,7 @@
                                                 'component'    =>  'CiviCase',
                                                 'href'    => CRM_Utils_System::url('civicrm/contact/view/case',
                                                                                         'reset=1&action=add&context=case'),
- 'permissions'  =>  array( 'access all cases and activities')
+ 'permissions'  =>  array( 'access my cases and activities')
  ),
                        'grant'      => array( 'title'        =>  ts( 'Add Grant' ),
                                                 'weight'    => 26,
« Last Edit: September 14, 2010, 12:38:53 pm by Leo »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • Permissions to create new case - basic question

This forum was archived on 2017-11-26.