Skip to content

Commit

Permalink
More permission access handling for civicrm/admin/financial/financial…
Browse files Browse the repository at this point in the history
…Type?reset=1 to extension

(works for browse & edit)
  • Loading branch information
eileenmcnaughton committed Jan 19, 2022
1 parent 6616e63 commit 6b0ec6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
6 changes: 0 additions & 6 deletions CRM/Financial/Form/FinancialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ class CRM_Financial_Form_FinancialType extends CRM_Core_Form {
* @throws \CRM_Core_Exception
*/
public function preProcess() {
// Check permission for Financial Type when ACL-FT is enabled
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
&& !CRM_Core_Permission::check('administer CiviCRM Financial Types')
) {
CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
parent::preProcess();
$this->setPageTitle(ts('Financial Type'));
Expand Down
6 changes: 0 additions & 6 deletions CRM/Financial/Page/FinancialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ public function &links() {
* Browse all financial types.
*/
public function browse() {
// Check permission for Financial Type when ACL-FT is enabled
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
&& !CRM_Core_Permission::check('administer CiviCRM Financial Types')
) {
CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
// get all financial types sorted by weight
$financialType = [];
$dao = new CRM_Financial_DAO_FinancialType();
Expand Down
9 changes: 9 additions & 0 deletions ext/financialacls/financialacls.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,15 @@ function financialacls_civicrm_preProcess($formName, &$form) {

}

/**
* Require financial acl permissions for financial screens.
*
* @param array $menu
*/
function financialacls_civicrm_alterMenu(array &$menu): void {
$menu['civicrm/admin/financial/financialType']['access_arguments'] = [['administer CiviCRM Financial Types']];
}

/**
* Implements hook_civicrm_navigationMenu().
*
Expand Down

0 comments on commit 6b0ec6c

Please sign in to comment.