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


PHP Application_Model_User::isSuperAdmin方法代码示例

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


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

示例1: userCan

 /**
  * Still playing around with how I want to handle permissions.
  * This is a method that can be called before each action to 
  * see if the user can do what they are asking to.
  * 
  * @access public
  * @return void
  */
 protected function userCan()
 {
     // User can edit themselves
     if ($this->id == $this->user->getId()) {
         return true;
     }
     // TODO: Need to expand upon this? Probably...
     // we can add in what the user is trying to do, and check perms
     // on top of just ownership. This will do for now.
     if ($this->id) {
         if ($this->user->isParentOf($this->id) || $this->user->isSuperAdmin()) {
             return true;
         }
     } else {
         // If there was no id already set, we are probably adding a folder.
         // TODO: Need to handle perms somehow here.
         return true;
     }
     // Set this entity to not valid so we do not give anything away
     // TODO: Maybe make a default() method that we can reset a built entity to it's defaults.
     // defaults could be set from the entity profile.
     $this->valid = false;
     $this->error = 'User does not have permission to execute the request.';
     //$this->error = 'ID does not exist for this user.';
     return false;
 }
开发者ID:fniftaly,项目名称:Java-Selenium,代码行数:34,代码来源:Entityabstract.php


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