--CRM-17569, changed code to check permission in preprocess when ACL-FT is enabled...
authorPradeep Nayak <pradpnayak@gmail.com>
Fri, 13 Nov 2015 00:50:25 +0000 (06:20 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Fri, 13 Nov 2015 00:51:28 +0000 (06:21 +0530)
CRM/Contribute/xml/Menu/Contribute.xml
CRM/Financial/Form/FinancialType.php
CRM/Financial/Page/FinancialType.php

index ddbc7ec6f97204d094a6c66194e2569663cc36fb..ef8694e9d3aa1c5a35a30cb6df262863da880f72 100644 (file)
     <page_callback>CRM_Financial_Page_FinancialType</page_callback>
     <desc>Formerly civicrm_contribution_type merged into this table in 4.1</desc>
     <adminGroup>CiviContribute</adminGroup>
-    <access_arguments>administer CiviCRM Financial Types</access_arguments>
     <weight>580</weight>
   </item>
   <item>
index 424e7ff19aa52a3c1874691e0672936424934a9d..c8069885ad6e2d8edeafda7fa01fedeb448852b9 100644 (file)
  */
 class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
 
+  /**
+   * Set variables up before form is built.
+   */
+  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::fatal(ts('You do not have permission to access this page.'));
+    }
+    parent::preProcess();
+  }
+
   /**
    * Build the form object.
    */
index de0804506b3b4882e099e3a31678ffc4985d24ad..8dfb71aa8d59085a4c5754635000f2290ccb9b5d 100644 (file)
@@ -124,6 +124,12 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic {
    * 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::fatal(ts('You do not have permission to access this page.'));
+    }
     // get all financial types sorted by weight
     $financialType = array();
     $dao = new CRM_Financial_DAO_FinancialType();