当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Financial_BAO_FinancialType::permissionedFinancialTypes方法代码示例

本文整理汇总了PHP中CRM_Financial_BAO_FinancialType::permissionedFinancialTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_BAO_FinancialType::permissionedFinancialTypes方法的具体用法?PHP CRM_Financial_BAO_FinancialType::permissionedFinancialTypes怎么用?PHP CRM_Financial_BAO_FinancialType::permissionedFinancialTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Financial_BAO_FinancialType的用法示例。


在下文中一共展示了CRM_Financial_BAO_FinancialType::permissionedFinancialTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assembleBasicPermissions

 /**
  * @param bool $all
  * @param bool $descriptions
  *   whether to return descriptions
  *
  * @return array
  */
 public static function assembleBasicPermissions($all = FALSE, $descriptions = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     $prefix = ts('CiviCRM') . ': ';
     $permissions = self::getCorePermissions($descriptions);
     if (self::isMultisiteEnabled()) {
         $permissions['administer Multiple Organizations'] = array($prefix . ts('administer Multiple Organizations'));
     }
     if (!$descriptions) {
         foreach ($permissions as $name => $attr) {
             $permissions[$name] = array_shift($attr);
         }
     }
     if (!$all) {
         $components = CRM_Core_Component::getEnabledComponents();
     } else {
         $components = CRM_Core_Component::getComponents();
     }
     foreach ($components as $comp) {
         $perm = $comp->getPermissions(FALSE, $descriptions);
         if ($perm) {
             $info = $comp->getInfo();
             foreach ($perm as $p => $attr) {
                 if (!is_array($attr)) {
                     $attr = array($attr);
                 }
                 $attr[0] = $info['translatedName'] . ': ' . $attr[0];
                 if ($descriptions) {
                     $permissions[$p] = $attr;
                 } else {
                     $permissions[$p] = $attr[0];
                 }
             }
         }
     }
     // Add any permissions defined in hook_civicrm_permission implementations.
     $module_permissions = $config->userPermissionClass->getAllModulePermissions($descriptions);
     $permissions = array_merge($permissions, $module_permissions);
     CRM_Financial_BAO_FinancialType::permissionedFinancialTypes($permissions, $descriptions);
     return $permissions;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:48,代码来源:Permission.php

示例2: testPermissionedFinancialTypes

 /**
  * Check method testPermissionedFinancialTypes()
  */
 public function testPermissionedFinancialTypes()
 {
     // First get all core permissions
     $permissions = $checkPerms = CRM_Core_Permission::getCorePermissions();
     $this->setACL();
     CRM_Financial_BAO_FinancialType::permissionedFinancialTypes($permissions, TRUE);
     $financialTypes = CRM_Contribute_PseudoConstant::financialType();
     $prefix = ts('CiviCRM') . ': ';
     $actions = array('add', 'view', 'edit', 'delete');
     foreach ($financialTypes as $id => $type) {
         foreach ($actions as $action) {
             $checkPerms[$action . ' contributions of type ' . $type] = array($prefix . ts($action . ' contributions of type ') . $type, ts(ucfirst($action) . ' contributions of type ') . $type);
         }
     }
     $checkPerms['administer CiviCRM Financial Types'] = array($prefix . ts('administer CiviCRM Financial Types'), ts('Administer access to Financial Types'));
     $this->assertEquals($permissions, $checkPerms, 'Verify that permissions for each financial type have been added');
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:20,代码来源:FinancialTypeTest.php


注:本文中的CRM_Financial_BAO_FinancialType::permissionedFinancialTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。