2

I am trying to limit access to reports using acl/groups as mentioned in the userguide :

https://docs.civicrm.org/user/en/4.7/reporting/set-up/#define-report-settings

However, the field to set this does not appear. access tab for report

Is there something i have to configure to make this appear? Or does this functionality no longer exist?

If relevant I am already using acl for controlling access to custom data sets.

Running civicrm 4.7.17 on wordpress 4.7.3 using php 7.0.15

UPDATE 1:

looking through the code it seems that the following code (found in /wp-content/plugins/civicrm/civicrm/CRM/Report/Form/instance.php) is causing it not to appear:

if (function_exists('user_roles')) {
        $user_roles_array = user_roles();
        foreach ($user_roles_array as $key => $value) {
          $user_roles[$value] = $value;
        }
        $grouprole = &$form->addElement('advmultiselect',
          'grouprole',
          ts('ACL Group/Role'),
          $user_roles,
          array(
            'size' => 5,
            'style' => 'width:240px',
            'class' => 'advmultiselect',
          )
        );
        $grouprole->setButtonAttributes('add', array('value' => ts('Add >>')));
        $grouprole->setButtonAttributes('remove', array('value' => ts('<< Remove')));
      }

For some reason the 'user_roles' function does not exist.

So when the below code is run (found in /wp-content/uploads/civicrm/templates_c/en_US/%%48/48E/48E22AAC%%Instance.tpl.php) the php returns nothing:

<tr class="crm-report-instanceForm-form-block-role">
        <td class="report-label" width="20%"><?php echo $this->_tpl_vars['form']['grouprole']['label']; ?>
</td>
        <td><?php echo ((is_array($_tmp=$this->_tpl_vars['form']['grouprole']['html'])) ? $this->_run_mod_handler('crmAddClass', true, $_tmp, 'huge') : smarty_modifier_crmAddClass($_tmp, 'huge')); ?>
</td>
      </tr>

UPDATE 2:

looking a little higher in instance.php it looks like this might not be for wordpress even though this section still runs:

if ($config->userFramework != 'Joomla' ||
      $config->userFramework != 'WordPress'
    ) 

still unsure of why 'grouprole' doesnt exist for the other code though:

<tr class="crm-report-instanceForm-form-block-role">
        <td class="report-label" width="20%"><?php echo $this->_tpl_vars['form']['grouprole']['label']; ?>
</td>
        <td><?php echo ((is_array($_tmp=$this->_tpl_vars['form']['grouprole']['html'])) ? $this->_run_mod_handler('crmAddClass', true, $_tmp, 'huge') : smarty_modifier_crmAddClass($_tmp, 'huge')); ?>
</td>
      </tr>
1
  • It shows on my 4.7.17 so the functionality still exists. Not sure though why you're not seeing it.
    – Aidan
    Commented Mar 30, 2017 at 10:02

2 Answers 2

1

I think this is a CMS issue. I see those options available at Drupal Demo but not at WP Demo

1
  • doesnt show on joomla either. i find it hard to believe that its a drupal only feature
    – pok
    Commented Apr 3, 2017 at 10:39
1

A temporary fix

I have managed to make it appear by modifying the code, though this isnt an ideal solution as updating will probably remove the change.

By replacing this (in instance.php):

if (function_exists('user_roles')) {
        $user_roles_array = user_roles();
        foreach ($user_roles_array as $key => $value) {
          $user_roles[$value] = $value;
        } // also remove the ending if bracket

with this:

$lib = URE_Lib::get_instance();
        $lib->get_user_roles();
        $user_roles_array = $lib->get('roles');
        $count = 1;
        foreach ($user_roles_array as $key => $value) {
          $user_roles[$count] = $key ;
          $count++;
        }

the wordpress user roles appear allowing the reports to be restricted based on wordpress roles.

It would be nice to see a proper solution for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.