From 3a662b5151d91119e7a6fbabd5f7904c6f5dc12d Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Fri, 3 Jul 2015 19:02:01 +0530 Subject: [PATCH] check ACL permission for buttons --- CRM/Event/Form/ManageEvent/Registration.php | 14 ++++++++++++++ templates/CRM/UF/Page/ProfileTemplates.tpl | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index 3a24bb1d96..3ba4c1b0a8 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -75,6 +75,20 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent } } + $this->assign('perm', 0); + $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); + $ufCreate = CRM_ACL_API::group(CRM_Core_Permission::CREATE, NULL, 'civicrm_uf_group', $ufGroups); + $ufEdit = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', $ufGroups); + $checkPermission = array( + array( + 'administer CiviCRM', + 'manage event profiles', + ) + ); + if (CRM_Core_Permission::check($checkPermission) || !empty($ufCreate) || !empty($ufEdit)) { + $this->assign('perm', 1); + } + $this->assign('addProfileBottomAdd', $this->_addProfileBottomAdd); $this->assign('profileBottomNumAdd', $this->_profileBottomNumAdd); diff --git a/templates/CRM/UF/Page/ProfileTemplates.tpl b/templates/CRM/UF/Page/ProfileTemplates.tpl index c1a9796311..7c5a78a6fd 100644 --- a/templates/CRM/UF/Page/ProfileTemplates.tpl +++ b/templates/CRM/UF/Page/ProfileTemplates.tpl @@ -115,7 +115,7 @@
- {if call_user_func(array('CRM_Core_Permission', 'check'), 'administer CiviCRM') OR call_user_func(array('CRM_Core_Permission', 'check'), 'manage event profiles')} + {if $perm EQ 1} -- 2.25.1