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


PHP RightsUtil::doesUserHaveAllowByRightName方法代码示例

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


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

示例1: canCurrentUserPushDashboardOrLayout

 /**
  * Validates if current user has rights to push dashboard to users
  * @return bool
  */
 public static function canCurrentUserPushDashboardOrLayout()
 {
     if (RightsUtil::doesUserHaveAllowByRightName('ZurmoModule', ZurmoModule::RIGHT_PUSH_DASHBOARD_OR_LAYOUT, Yii::app()->user->userModel)) {
         return true;
     }
     return false;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:11,代码来源:PushDashboardUtil.php

示例2: renderEmailMessageToMatchContent

 /**
  * @return string content
  * @param EmailMessage object $emailMessage
  * @param User object $user
  */
 public static function renderEmailMessageToMatchContent(EmailMessage $emailMessage, $user)
 {
     $userCanAccessContacts = RightsUtil::canUserAccessModule('ContactsModule', $user);
     $userCanAccessLeads = RightsUtil::canUserAccessModule('LeadsModule', $user);
     $userCanCreateContact = RightsUtil::doesUserHaveAllowByRightName('ContactsModule', ContactsModule::getCreateRight(), $user);
     $userCanCreateLead = RightsUtil::doesUserHaveAllowByRightName('LeadsModule', LeadsModule::getCreateRight(), $user);
     if ($userCanAccessLeads && $userCanAccessContacts) {
         $selectForm = new AnyContactSelectForm();
     } elseif (!$userCanAccessLeads && $userCanAccessContacts) {
         $selectForm = new ContactSelectForm();
     } else {
         $selectForm = new LeadSelectForm();
     }
     if ($userCanCreateContact && $userCanCreateLead) {
         $gridSize = 3;
     } elseif ($userCanCreateContact || $userCanCreateLead) {
         $gridSize = 2;
     } else {
         $gridSize = 1;
     }
     $contact = new Contact();
     self::resolveEmailAddressAndNameToContact($emailMessage, $contact);
     $view = new ArchivedEmailMatchingView('default', 'emailMessages', $emailMessage, $contact, $selectForm, $userCanAccessLeads, $userCanAccessContacts, $userCanCreateContact, $userCanCreateLead, $gridSize);
     return $view->render();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:30,代码来源:ArchivedEmailMatchingUtil.php

示例3: getImportRulesTypesForCurrentUser

 /**
  * Based on the current user, return the importRules types and their display labels.  Only include import rules
  * that the user has a right to access its corresponding module.
  * @return array of import rules types and display labels.
  */
 public static function getImportRulesTypesForCurrentUser()
 {
     //todo: cache results to improve performance if needed.
     $importRulesTypes = array();
     $modules = Module::getModuleObjects();
     foreach ($modules as $module) {
         $rulesClassNames = $module::getAllClassNamesByPathFolder('rules');
         foreach ($rulesClassNames as $ruleClassName) {
             $classToEvaluate = new ReflectionClass($ruleClassName);
             if (is_subclass_of($ruleClassName, 'ImportRules') && !$classToEvaluate->isAbstract()) {
                 $moduleClassNames = $ruleClassName::getModuleClassNames();
                 $addToArray = true;
                 foreach ($moduleClassNames as $moduleClassNameToCheckAccess) {
                     if (!RightsUtil::canUserAccessModule($moduleClassNameToCheckAccess, Yii::app()->user->userModel) || !RightsUtil::doesUserHaveAllowByRightName($moduleClassNameToCheckAccess, $moduleClassNameToCheckAccess::getCreateRight(), Yii::app()->user->userModel)) {
                         $addToArray = false;
                     }
                 }
                 if ($addToArray) {
                     $importRulesTypes[$ruleClassName::getType()] = $ruleClassName::getDisplayLabel();
                 }
             }
         }
     }
     return $importRulesTypes;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:30,代码来源:ImportRulesUtil.php

示例4: getDefaultRoute

 /**
  * @return string
  */
 protected function getDefaultRoute()
 {
     if (RightsUtil::doesUserHaveAllowByRightName('ContactWebFormsModule', ContactWebFormsModule::getCreateRight(), Yii::app()->user->userModel)) {
         return Yii::app()->createUrl('contactWebForms/default/create/');
     }
     return null;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:10,代码来源:ContactWebFormsCreateMenuActionElement.php

示例5: preFilter

 protected function preFilter($filterChain)
 {
     if (RightsUtil::doesUserHaveAllowByRightName($this->moduleClassName, $this->rightName, Yii::app()->user->userModel)) {
         return true;
     }
     static::processAccessFailure();
     Yii::app()->end(0, false);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:8,代码来源:RightsControllerFilter.php

示例6: getMenuItems

 public function getMenuItems()
 {
     $items = array();
     if (RightsUtil::doesUserHaveAllowByRightName('WorkflowsModule', WorkflowsModule::getCreateRight(), Yii::app()->user->userModel)) {
         $items[] = array('label' => Zurmo::t('WorkflowsModule', 'Create Workflow'), 'url' => Yii::app()->createUrl('workflows/default/create'));
         return $items;
     }
     return null;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:9,代码来源:WorkflowsMenuActionElement.php

示例7: getMenuItems

 public function getMenuItems()
 {
     $items = array();
     if (RightsUtil::doesUserHaveAllowByRightName('EmailTemplatesModule', EmailTemplatesModule::getCreateRight(), Yii::app()->user->userModel)) {
         $items[] = array('label' => Zurmo::t('EmailTemplatesModule', 'Create Template'), 'url' => Yii::app()->createUrl('emailTemplates/default/create', array('type' => EmailTemplate::TYPE_WORKFLOW)));
         return $items;
     }
     return null;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:9,代码来源:EmailTemplatesForWorkflowMenuActionElement.php

示例8: getMenuItems

 protected function getMenuItems()
 {
     $items = array();
     if (RightsUtil::doesUserHaveAllowByRightName('CampaignsModule', CampaignsModule::getCreateRight(), Yii::app()->user->userModel)) {
         $items[] = array('label' => Zurmo::t('CampaignsModule', 'Create Campaign'), 'url' => Yii::app()->createUrl('campaigns/default/create'));
         return $items;
     }
     return null;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:9,代码来源:CampaignsMenuActionElement.php

示例9: renderContent

 protected function renderContent()
 {
     $url = $this->getCreateMeetingUrl();
     $content = ZurmoHtml::openTag('div', array('class' => $this->getIconName()));
     $content .= $this->getMessageContent();
     if (RightsUtil::doesUserHaveAllowByRightName('MeetingsModule', MeetingsModule::getCreateRight(), Yii::app()->user->userModel)) {
         $content .= ZurmoHtml::link(ZurmoHtml::wrapLabel($this->getCreateLinkDisplayLabel()), $url, array('class' => 'z-button green-button'));
     }
     $content .= ZurmoHtml::closeTag('div');
     return $content;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:NoMeetingsYetView.php

示例10: getMenuItems

 /**
  * @return null or string containing create link
  */
 public function getMenuItems()
 {
     $items = array();
     if (RightsUtil::doesUserHaveAllowByRightName('ProductTemplatesModule', ProductTemplatesModule::getCreateRight(), Yii::app()->user->userModel)) {
         $items[] = array('label' => Zurmo::t('ProductTemplatesModule', 'Create Category'), 'url' => Yii::app()->createUrl('productTemplates/category/create'));
     }
     if (!empty($items)) {
         return $items;
     }
     return null;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:14,代码来源:ProductCategoriesMenuActionElement.php

示例11: getMenuItems

 protected function getMenuItems()
 {
     $items = array();
     if (RightsUtil::doesUserHaveAllowByRightName('ProductsModule', ProductsModule::getCreateRight(), Yii::app()->user->userModel)) {
         $items[] = array('label' => Zurmo::t('ProductsModule', 'Create ProductsModuleSingularLabel', LabelUtil::getTranslationParamsForAllModules()), 'url' => Yii::app()->createUrl('products/default/create'));
     }
     if (!empty($items)) {
         return $items;
     }
     return null;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:ProductsMenuActionElement.php

示例12: canUserPerformAction

 /**
  * @return boolean - true if user can perform action
  */
 public function canUserPerformAction()
 {
     $rightToCheckArray = $this->getRightToCheck();
     if (empty($rightToCheckArray) && $permissionToCheck == null) {
         throw new NotSupportedException();
     }
     if (!empty($rightToCheckArray)) {
         if (!RightsUtil::doesUserHaveAllowByRightName($rightToCheckArray[0], $rightToCheckArray[1], $this->user)) {
             return false;
         }
     }
     return true;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:16,代码来源:RightsOnlyActionSecurity.php

示例13: shouldRenderToolBarElement

 /**
  * Override to check for delete rights
  * Checks for $elementInformation['resolveToDisplay'] to be present and if it is,
  * will run the resolveName as a function on the group model.
  * @param $element
  * @param $elementInformation
  * @return bool
  */
 protected function shouldRenderToolBarElement($element, $elementInformation)
 {
     assert('$element instanceof ActionElement');
     assert('is_array($elementInformation)');
     if (!parent::shouldRenderToolBarElement($element, $elementInformation)) {
         return false;
     }
     $actionType = $element->getActionType();
     if ($actionType == null || $actionType != 'Delete') {
         return true;
     }
     return RightsUtil::doesUserHaveAllowByRightName('RolesModule', $actionType, Yii::app()->user->userModel);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:21,代码来源:RoleEditAndDetailsView.php

示例14: render

 public function render()
 {
     $items = array();
     if (RightsUtil::doesUserHaveAllowByRightName('WorkflowsModule', WorkflowsModule::getCreateRight(), Yii::app()->user->userModel)) {
         $items[] = array('label' => Zurmo::t('WorkflowsModule', 'Create Workflow'), 'url' => Yii::app()->createUrl('workflows/default/create'));
     }
     if (RightsUtil::doesUserHaveAllowByRightName('EmailTemplatesModule', EmailTemplatesModule::getCreateRight(), Yii::app()->user->userModel)) {
         $items[] = array('label' => Zurmo::t('EmailTemplatesModule', 'Create Template'), 'url' => Yii::app()->createUrl('emailTemplates/default/create', array('type' => EmailTemplate::TYPE_WORKFLOW)));
     }
     if (!empty($items)) {
         $menuItems = array('label' => $this->getLabel(), 'url' => null, 'items' => $items);
         $cClipWidget = new CClipWidget();
         $cClipWidget->beginClip("ActionMenu");
         $cClipWidget->widget('application.core.widgets.MbMenu', array('htmlOptions' => array('id' => 'MashableInboxCreateDropdown'), 'items' => array($menuItems)));
         $cClipWidget->endClip();
         return $cClipWidget->getController()->clips['ActionMenu'];
     }
     return null;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:19,代码来源:WorkflowCreateLinkActionElement.php

示例15: shouldRenderToolBarElement

 /**
  * Override to check for different scenarios depending on if the group is
  * special or not. Everyone and SuperAdministrators are special groups
  * for example.
  * Checks for $elementInformation['resolveToDisplay'] to be present and if it is,
  * will run the resolveName as a function on the group model.
  * @param $element
  * @param $elementInformation
  * @return bool
  */
 protected function shouldRenderToolBarElement($element, $elementInformation)
 {
     assert('$element instanceof ActionElement');
     assert('is_array($elementInformation)');
     if (!parent::shouldRenderToolBarElement($element, $elementInformation)) {
         return false;
     }
     if (isset($elementInformation['resolveToDisplay'])) {
         $resolveMethodName = $elementInformation['resolveToDisplay'];
         if (!$this->model->{$resolveMethodName}()) {
             return false;
         }
     }
     $actionType = $element->getActionType();
     if ($actionType == null || $actionType != 'Delete') {
         return true;
     }
     return RightsUtil::doesUserHaveAllowByRightName('GroupsModule', GroupsModule::RIGHT_DELETE_GROUPS, Yii::app()->user->userModel);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:29,代码来源:GroupEditAndDetailsView.php


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