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


PHP CRM_Core_Permission::checkAnyPerm方法代码示例

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


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

示例1: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     $this->_isTemplate = (bool) CRM_Utils_Request::retrieve('template', 'Integer', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
     if ($this->_isTemplate) {
         CRM_Utils_System::setTitle(ts('New Vacancy Template'));
     }
     if ($this->_id) {
         if ($this->_isTemplate = CRM_Core_DAO::getFieldValue('CRM_HRRecruitment_DAO_HRVacancy', $this->_id, 'is_template')) {
             CRM_Utils_System::setTitle(ts('Edit Vacancy Template'));
         } else {
             CRM_Utils_System::setTitle(ts('Edit Vacancy'));
         }
     }
     $this->assign('isTemplate', $this->_isTemplate);
     $session = CRM_Core_Session::singleton();
     if ($this->_id) {
         $permission = CRM_HRRecruitment_BAO_HRVacancyPermission::checkVacancyPermission($this->_id, array("administer Vacancy", "administer CiviCRM"));
     } else {
         $permission = CRM_Core_Permission::checkAnyPerm(array("administer Vacancy", "administer CiviCRM"));
     }
     if (!$permission) {
         $session->pushUserContext(CRM_Utils_System::url('civicrm'));
         CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to perform this action.'));
     }
     CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrrecruitment', 'templates/CRM/HRRecruitment/Form/HRVacancy.js');
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:33,代码来源:HRVacancy.php

示例2: getUserRecordUrl

 /**
  * @inheritDoc
  */
 public function getUserRecordUrl($contactID)
 {
     $uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
     if (CRM_Core_Session::singleton()->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm(array('cms:administer users'))) {
         return CRM_Core_Config::singleton()->userFrameworkBaseURL . "wp-admin/user-edit.php?user_id=" . $uid;
     }
 }
开发者ID:sarehag,项目名称:civicrm-core,代码行数:10,代码来源:WordPress.php

示例3: pick

 /**
  * Pick a message to display.
  *
  * @return NULL|array
  */
 public function pick()
 {
     $document = $this->getDocument();
     $messages = array();
     foreach ($document['messages'] as $message) {
         if (!isset($message['perms'])) {
             $message['perms'] = array(self::DEFAULT_PERMISSION);
         }
         if (!CRM_Core_Permission::checkAnyPerm($message['perms'])) {
             continue;
         }
         if (isset($message['components'])) {
             $enabled = array_keys(CRM_Core_Component::getEnabledComponents());
             if (count(array_intersect($enabled, $message['components'])) == 0) {
                 continue;
             }
         }
         $messages[] = $message;
     }
     if (empty($messages)) {
         return NULL;
     }
     $idx = rand(0, count($messages) - 1);
     return $messages[$idx];
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:30,代码来源:CommunityMessages.php

示例4: getUserRecordUrl

 /**
  * @inheritDoc
  */
 public function getUserRecordUrl($contactID)
 {
     $uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
     if (CRM_Core_Session::singleton()->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm(array('cms:administer users', 'cms:view user account'))) {
         return CRM_Utils_System::url('user/' . $uid);
     }
 }
开发者ID:ucam-dar,项目名称:civicrm-core,代码行数:10,代码来源:DrupalBase.php

示例5: addUrls

 /**
  * Add urls for display in the actions menu
  */
 static function addUrls(&$obj, $cid)
 {
     // TODO rewrite without so many hard-coded CMS bits; use abstractions like CRM_Core_Permission::check('cms:...') and CRM_Utils_System
     $config = CRM_Core_Config::singleton();
     $session = CRM_Core_Session::singleton();
     $uid = CRM_Core_BAO_UFMatch::getUFId($cid);
     $userRecordUrl = NULL;
     if ($uid) {
         if ($config->userSystem->is_drupal == '1' && ($session->get('userID') == $cid || CRM_Core_Permission::checkAnyPerm(array('cms:administer users', 'cms:view user account')))) {
             $userRecordUrl = CRM_Utils_System::url('user/' . $uid);
         } elseif ($config->userFramework == 'Joomla') {
             $userRecordUrl = NULL;
             // if logged in user is super user, then he can view other users joomla profile
             if (JFactory::getUser()->authorise('core.admin')) {
                 $userRecordUrl = $config->userFrameworkBaseURL . "index.php?option=com_users&view=user&task=user.edit&id=" . $uid;
             } elseif ($session->get('userID') == $cid) {
                 $userRecordUrl = $config->userFrameworkBaseURL . "index.php?option=com_admin&view=profile&layout=edit&id=" . $uid;
             }
         } elseif ($config->userFramework == 'WordPress' && ($session->get('userID') == $cid || CRM_Core_Permission::checkAnyPerm(array('cms:administer users')))) {
             $userRecordUrl = $config->userFrameworkBaseURL . "wp-admin/user-edit.php?user_id=" . $uid;
         }
         $obj->assign('userRecordUrl', $userRecordUrl);
         $obj->assign('userRecordId', $uid);
     } elseif ($config->userSystem->is_drupal == '1' && CRM_Core_Permission::check('administer users') || $config->userFramework == 'Joomla' && JFactory::getUser()->authorise('core.create', 'com_users')) {
         $userAddUrl = CRM_Utils_System::url('civicrm/contact/view/useradd', 'reset=1&action=add&cid=' . $cid);
         $obj->assign('userAddUrl', $userAddUrl);
     }
     if (CRM_Core_Permission::check('access Contact Dashboard')) {
         $dashboardURL = CRM_Utils_System::url('civicrm/user', "reset=1&id={$cid}");
         $obj->assign('dashboardURL', $dashboardURL);
     }
     // See if other modules want to add links to the activtity bar
     $hookLinks = array();
     CRM_Utils_Hook::links('view.contact.activity', 'Contact', $cid, $hookLinks, CRM_Core_DAO::$_nullObject, CRM_Core_DAO::$_nullObject);
     if (is_array($hookLinks)) {
         $obj->assign('hookLinks', $hookLinks);
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:41,代码来源:View.php


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