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


PHP Scalr_Account_User::isTeamUserInEnvironment方法代码示例

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


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

示例1: callActionMethod

 public function callActionMethod($method)
 {
     if ($this->request->getRequestType() == Scalr_UI_Request::REQUEST_TYPE_API) {
         $apiMethodCheck = false;
         if (method_exists($this, 'getApiDefinitions')) {
             $api = $this::getApiDefinitions();
             $m = str_replace('Action', '', $method);
             if (in_array($m, $api)) {
                 $apiMethodCheck = true;
             }
         }
         if (!$apiMethodCheck) {
             throw new Scalr_UI_Exception_NotFound();
         }
     }
     if ($this->user) {
         if ($this->user->getType() == Scalr_Account_User::TYPE_TEAM_USER) {
             if (!$this->user->isTeamUserInEnvironment($this->getEnvironmentId(), Scalr_Account_Team::PERMISSIONS_OWNER) && !$this->user->isTeamUserInEnvironment($this->getEnvironmentId(), Scalr_Account_Team::PERMISSIONS_FULL)) {
                 if (method_exists($this, 'getPermissionDefinitions')) {
                     // rules defined for this controller
                     $cls = get_class($this);
                     $clsShort = str_replace('Scalr_UI_Controller_', '', $cls);
                     $methodShort = str_replace('Action', '', $method);
                     $clsPermissions = $cls::getPermissionDefinitions();
                     $permissions = $this->user->getGroupPermissions($this->getEnvironmentId());
                     if (array_key_exists($clsShort, $permissions)) {
                         // rules for user and such controller
                         $perm = $permissions[$clsShort];
                         if (!in_array('FULL', $perm, true)) {
                             // user doesn't has full privilegies
                             if (array_key_exists($methodShort, $clsPermissions)) {
                                 // standalone rule for this method
                                 if (!in_array($clsPermissions[$methodShort], $perm)) {
                                     throw new Scalr_Exception_InsufficientPermissions();
                                 }
                             } else {
                                 // VIEW rule
                                 if (!in_array('VIEW', $perm)) {
                                     throw new Scalr_Exception_InsufficientPermissions();
                                 }
                             }
                         }
                     } else {
                         throw new Scalr_Exception_InsufficientPermissions();
                     }
                 }
             }
         }
     }
     $this->{$method}();
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:51,代码来源:Controller.php


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