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


PHP AbstractHandler::permissions方法代码示例

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


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

示例1: permissions

 /**
  * {@inheritdoc}
  */
 public function permissions($object, $context)
 {
     $permissions = parent::permissions($object, $context);
     /** Initialize permissions */
     $permissions['deals']['view'] = false;
     $permissions['payments']['view'] = false;
     $permissions['activities']['view'] = false;
     $permissions['phones']['view'] = false;
     /** Deal permissions */
     if ($this->securityContext->isGranted('ROLE_DEAL_VIEW_ALL')) {
         $permissions['deals']['view'] = true;
     }
     if ($this->securityContext->isGranted('ROLE_DEAL_VIEW_OWN') && $object->getUser() == $this->user) {
         $permissions['deals']['view'] = true;
     }
     $permissions['deals']['edit'] = $this->securityContext->isGranted('ROLE_DEAL_EDIT');
     $permissions['deals']['remove'] = $this->securityContext->isGranted('ROLE_DEAL_REMOVE');
     $permissions['deals']['add'] = $this->securityContext->isGranted('ROLE_DEAL_ADD');
     /** Payment permissions */
     if ($this->securityContext->isGranted('ROLE_PAYMENT_VIEW_ALL')) {
         $permissions['payments']['view'] = true;
     }
     if ($this->securityContext->isGranted('ROLE_PAYMENT_VIEW_OWN') && $object->getUser() == $this->user) {
         $permissions['payments']['view'] = true;
     }
     $permissions['payments']['edit'] = $this->securityContext->isGranted('ROLE_PAYMENT_EDIT');
     $permissions['payments']['remove'] = $this->securityContext->isGranted('ROLE_PAYMENT_REMOVE');
     $permissions['payments']['add'] = $this->securityContext->isGranted('ROLE_PAYMENT_ADD');
     /** Activity permissions */
     if ($this->securityContext->isGranted('ROLE_ACTIVITY_VIEW_ALL')) {
         $permissions['activities']['view'] = true;
     }
     if ($this->securityContext->isGranted('ROLE_ACTIVITY_VIEW_OWN') && $object->getUser() == $this->user) {
         $permissions['activities']['view'] = true;
     }
     $permissions['activities']['add'] = $this->securityContext->isGranted('ROLE_ACTIVITY_ADD');
     $permissions['activities']['edit'] = $this->securityContext->isGranted('ROLE_ACTIVITY_EDIT');
     $permissions['activities']['remove'] = $this->securityContext->isGranted('ROLE_ACTIVITY_REMOVE');
     /** Phone permissions */
     if ($this->securityContext->isGranted('ROLE_PHONE_VIEW_ALL')) {
         $permissions['phones']['view'] = true;
     }
     if ($this->securityContext->isGranted('ROLE_PHONE_VIEW_OWN') && $object->getUser() == $this->user) {
         $permissions['phones']['view'] = true;
     }
     $permissions['phones']['add'] = $this->securityContext->isGranted('ROLE_PHONE_ADD');
     $permissions['phones']['edit'] = $this->securityContext->isGranted('ROLE_PHONE_EDIT');
     $permissions['phones']['remove'] = $this->securityContext->isGranted('ROLE_PHONE_REMOVE');
     return $permissions;
 }
开发者ID:Exanrus,项目名称:crm-bundle,代码行数:53,代码来源:ClientHandler.php

示例2: permissions

 /**
  * {@inheritdoc}
  */
 public function permissions($object, $context)
 {
     $permissions = parent::permissions($object, $context);
     $permissions['activities']['view'] = false;
     $permissions['channels']['view'] = false;
     $permissions['clients']['view'] = false;
     $permissions['companies']['view'] = false;
     $permissions['customFields']['view'] = false;
     $permissions['deals']['view'] = false;
     $permissions['dealStates']['view'] = false;
     $permissions['groups']['view'] = false;
     $permissions['payments']['view'] = false;
     $permissions['phones']['view'] = false;
     $permissions['products']['view'] = false;
     $permissions['tags']['view'] = false;
     /** Activity permissions */
     if ($this->securityContext->isGranted(['ROLE_ACTIVITY_VIEW_ALL', 'ROLE_ACTIVITY_VIEW_OWN'])) {
         $permissions['activities']['view'] = true;
     }
     $permissions['activities']['edit'] = $this->securityContext->isGranted('ROLE_ACTIVITY_EDIT');
     $permissions['activities']['remove'] = $this->securityContext->isGranted('ROLE_ACTIVITY_REMOVE');
     $permissions['activities']['add'] = $this->securityContext->isGranted('ROLE_ACTIVITY_ADD');
     /** Channel permissions */
     if ($this->securityContext->isGranted('ROLE_CHANNEL_VIEW_ALL')) {
         $permissions['channels']['view'] = true;
     }
     $permissions['channels']['edit'] = $this->securityContext->isGranted('ROLE_CHANNEL_EDIT');
     $permissions['channels']['remove'] = $this->securityContext->isGranted('ROLE_CHANNEL_REMOVE');
     $permissions['channels']['add'] = $this->securityContext->isGranted('ROLE_CHANNEL_ADD');
     /** Client permissions */
     if ($this->securityContext->isGranted(['ROLE_CLIENT_VIEW_ALL', 'ROLE_CLIENT_VIEW_OWN'])) {
         $permissions['clients']['view'] = true;
     }
     $permissions['clients']['edit'] = $this->securityContext->isGranted('ROLE_CLIENT_EDIT');
     $permissions['clients']['remove'] = $this->securityContext->isGranted('ROLE_CLIENT_REMOVE');
     $permissions['clients']['add'] = $this->securityContext->isGranted('ROLE_CLIENT_ADD');
     /** Company permissions */
     if ($this->securityContext->isGranted('ROLE_COMPANY_VIEW_ALL')) {
         $permissions['companies']['view'] = true;
     }
     $permissions['companies']['edit'] = $this->securityContext->isGranted('ROLE_COMPANY_EDIT');
     $permissions['companies']['remove'] = $this->securityContext->isGranted('ROLE_COMPANY_REMOVE');
     $permissions['companies']['add'] = $this->securityContext->isGranted('ROLE_COMPANY_ADD');
     /** Custom field permissions */
     if ($this->securityContext->isGranted('ROLE_CUSTOM_FIELD_VIEW_ALL')) {
         $permissions['customFields']['view'] = true;
     }
     $permissions['customFields']['edit'] = $this->securityContext->isGranted('ROLE_CUSTOM_FIELD_EDIT');
     $permissions['customFields']['remove'] = $this->securityContext->isGranted('ROLE_CUSTOM_FIELD_REMOVE');
     $permissions['customFields']['add'] = $this->securityContext->isGranted('ROLE_CUSTOM_FIELD_ADD');
     /** Deal permissions */
     if ($this->securityContext->isGranted(['ROLE_DEAL_VIEW_ALL', 'ROLE_DEAL_VIEW_OWN'])) {
         $permissions['deals']['view'] = true;
     }
     $permissions['deals']['edit'] = $this->securityContext->isGranted('ROLE_DEAL_EDIT');
     $permissions['deals']['remove'] = $this->securityContext->isGranted('ROLE_DEAL_REMOVE');
     $permissions['deals']['add'] = $this->securityContext->isGranted('ROLE_DEAL_ADD');
     /** Deal state permissions */
     if ($this->securityContext->isGranted(['ROLE_DEAL_STATE_VIEW_ALL', 'ROLE_DEAL_STATE_VIEW_OWN'])) {
         $permissions['dealStates']['view'] = true;
     }
     $permissions['dealStates']['edit'] = $this->securityContext->isGranted('ROLE_DEAL_STATE_EDIT');
     $permissions['dealStates']['remove'] = $this->securityContext->isGranted('ROLE_DEAL_STATE_REMOVE');
     $permissions['dealStates']['add'] = $this->securityContext->isGranted('ROLE_DEAL_STATE_ADD');
     /** Group permissions */
     if ($this->securityContext->isGranted('ROLE_GROUP_VIEW_ALL')) {
         $permissions['groups']['view'] = true;
     }
     $permissions['groups']['edit'] = $this->securityContext->isGranted('ROLE_GROUP_EDIT');
     $permissions['groups']['remove'] = $this->securityContext->isGranted('ROLE_GROUP_REMOVE');
     $permissions['groups']['add'] = $this->securityContext->isGranted('ROLE_GROUP_ADD');
     /** Payment permissions */
     if ($this->securityContext->isGranted(['ROLE_PAYMENT_VIEW_ALL', 'ROLE_PAYMENT_VIEW_OWN'])) {
         $permissions['payments']['view'] = true;
     }
     $permissions['payments']['edit'] = $this->securityContext->isGranted('ROLE_PAYMENT_EDIT');
     $permissions['payments']['remove'] = $this->securityContext->isGranted('ROLE_PAYMENT_REMOVE');
     $permissions['payments']['add'] = $this->securityContext->isGranted('ROLE_PAYMENT_ADD');
     /** Phone permissions */
     if ($this->securityContext->isGranted(['ROLE_PHONE_VIEW_ALL', 'ROLE_PHONE_VIEW_OWN'])) {
         $permissions['phones']['view'] = true;
     }
     $permissions['phones']['edit'] = $this->securityContext->isGranted('ROLE_PHONE_EDIT');
     $permissions['phones']['remove'] = $this->securityContext->isGranted('ROLE_PHONE_REMOVE');
     $permissions['phones']['add'] = $this->securityContext->isGranted('ROLE_PHONE_ADD');
     /** Product permissions */
     if ($this->securityContext->isGranted('ROLE_PRODUCT_VIEW_ALL')) {
         $permissions['products']['view'] = true;
     }
     $permissions['products']['edit'] = $this->securityContext->isGranted('ROLE_PRODUCT_EDIT');
     $permissions['products']['remove'] = $this->securityContext->isGranted('ROLE_PRODUCT_REMOVE');
     $permissions['products']['add'] = $this->securityContext->isGranted('ROLE_PRODUCT_ADD');
     /** Tag permissions */
     if ($this->securityContext->isGranted(['ROLE_TAG_VIEW_ALL', 'ROLE_TAG_VIEW_OWN'])) {
         $permissions['tags']['view'] = true;
     }
     $permissions['tags']['edit'] = $this->securityContext->isGranted('ROLE_TAG_EDIT');
//.........这里部分代码省略.........
开发者ID:Exanrus,项目名称:crm-bundle,代码行数:101,代码来源:UserHandler.php


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