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


PHP CRM_Core_Permission::getCorePermissions方法代码示例

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


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

示例1: generateJoomlaConfig

/**
 * @param $version
 */
function generateJoomlaConfig($version)
{
    global $targetDir, $sourceCheckoutDir, $pkgType;
    $smarty = new Smarty();
    $smarty->template_dir = $sourceCheckoutDir . '/xml/templates';
    $smarty->compile_dir = '/tmp/templates_c_u' . posix_geteuid();
    createDir($smarty->compile_dir);
    $smarty->assign('CiviCRMVersion', $version);
    $smarty->assign('creationDate', date('F d Y'));
    $smarty->assign('pkgType', $pkgType);
    $xml = $smarty->fetch('joomla.tpl');
    $output = $targetDir . '/civicrm.xml';
    $fd = fopen($output, "w");
    fwrite($fd, $xml);
    fclose($fd);
    require_once 'CRM/Core/Config.php';
    $config = CRM_Core_Config::singleton(FALSE);
    require_once 'CRM/Core/Permission.php';
    require_once 'CRM/Utils/String.php';
    require_once 'CRM/Core/I18n.php';
    $permissions = CRM_Core_Permission::getCorePermissions(TRUE);
    $crmFolderDir = $sourceCheckoutDir . DIRECTORY_SEPARATOR . 'CRM';
    require_once 'CRM/Core/Component.php';
    $components = CRM_Core_Component::getComponentsFromFile($crmFolderDir);
    foreach ($components as $comp) {
        $perm = $comp->getPermissions(FALSE, TRUE);
        if ($perm) {
            $info = $comp->getInfo();
            foreach ($perm as $p => $attr) {
                $title = $info['translatedName'] . ': ' . array_shift($attr);
                array_unshift($attr, $title);
                $permissions[$p] = $attr;
            }
        }
    }
    $perms_array = array();
    foreach ($permissions as $perm => $attr) {
        // give an empty string as default description
        $attr[] = '';
        //order matters here, but we deal with that later
        $perms_array[CRM_Utils_String::munge(strtolower($perm))] = array('title' => array_shift($attr), 'description' => array_shift($attr));
    }
    $smarty->assign('permissions', $perms_array);
    $output = $targetDir . '/admin/access.xml';
    $xml = $smarty->fetch('access.tpl');
    $fd = fopen($output, "w");
    fwrite($fd, $xml);
    fclose($fd);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:52,代码来源:joomlaxml.php

示例2: _multisite_add_permissions

/**
 * Should we be adding ACLs in this instance. If we don't add them the user
 * will not be able to see anything. We check if the install has the permissions
 * hook implemented correctly & if so only allow view & edit based on those.
 *
 * Otherwise all users get these permissions added (4.2 vs 4.3 / other CMS issues)
 *
 * @param integer $type type of operation
 *
 * @return bool
 */
function _multisite_add_permissions($type)
{
    $hookclass = 'CRM_Utils_Hook';
    if (!method_exists($hookclass, 'permissions')) {
        // ie. unpatched 4.2 so we can't check for extra declared permissions
        // & default to applying this to all
        return TRUE;
    }
    // extra check to make sure that hook is properly implemented
    // if not we won't check for it. NB view all contacts in domain is enough checking
    $declaredPermissions = CRM_Core_Permission::getCorePermissions();
    if (!array_key_exists('view all contacts in domain', $declaredPermissions)) {
        drupal_set_message('here');
        return TRUE;
    }
    if (CRM_ACL_BAO_ACL::matchType($type, 'View') && CRM_Core_Permission::check('view all contacts in domain')) {
        return TRUE;
    }
    if (CRM_ACL_BAO_ACL::matchType($type, 'Edit') && CRM_Core_Permission::check('edit all contacts in domain')) {
        return TRUE;
    }
    return FALSE;
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:34,代码来源:multisite.php

示例3: upgradePermissions

 /**
  * @inheritDoc
  */
 public function upgradePermissions($permissions)
 {
     $civicrm_perms = array_keys(CRM_Core_Permission::getCorePermissions());
     if (empty($civicrm_perms)) {
         throw new CRM_Core_Exception("Cannot upgrade permissions: permission list missing");
     }
     $roles = user_roles(TRUE);
     foreach ($roles as $role) {
         foreach ($civicrm_perms as $permission) {
             $role->revokePermission($permission);
         }
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:16,代码来源:Drupal8.php

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