Skip to content
Snippets Groups Projects
Commit ab788446 authored by deepak-srivastava's avatar deepak-srivastava
Browse files

Merge pull request #1790 from deepak-srivastava/cf-reports

CRM-13546 - Custom fields in CiviReport: 'access all custom data' permis...
parents 4441ae6c 4f8ec8be
Branches
Tags
No related merge requests found
......@@ -279,14 +279,17 @@ class CRM_Report_Form extends CRM_Core_Form {
// Get all custom groups
$allGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
// Get the custom groupIds for which the user have VIEW permission
require_once 'CRM/ACL/API.php';
$permCustomGroupIds = CRM_ACL_API::group(CRM_Core_Permission::VIEW, NULL, 'civicrm_custom_group', $allGroups, NULL);
// do not allow custom data for reports if user don't have
// permission to access custom data.
if (!empty($this->_customGroupExtends) && !CRM_Core_Permission::check('access all custom data') && empty($permCustomGroupIds)) {
$this->_customGroupExtends = array();
// Get the custom groupIds for which the user has VIEW permission
// If the user has 'access all custom data' permission, we'll leave $permCustomGroupIds empty
// and addCustomDataToColumns() will allow access to all custom groups.
$permCustomGroupIds = array();
if (!CRM_Core_Permission::check('access all custom data')) {
$permCustomGroupIds = CRM_ACL_API::group(CRM_Core_Permission::VIEW, NULL, 'civicrm_custom_group', $allGroups, NULL);
// do not allow custom data for reports if user doesn't have
// permission to access custom data.
if (!empty($this->_customGroupExtends) && empty($permCustomGroupIds)) {
$this->_customGroupExtends = array();
}
}
// merge custom data columns to _columns list, if any
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment