當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application_Model_User::isParentOf方法代碼示例

本文整理匯總了PHP中Application_Model_User::isParentOf方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application_Model_User::isParentOf方法的具體用法?PHP Application_Model_User::isParentOf怎麽用?PHP Application_Model_User::isParentOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Application_Model_User的用法示例。


在下文中一共展示了Application_Model_User::isParentOf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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

示例2: _isValid

 /**
  * Checks whether this keyword is a valid keyword or not... useful for 
  * saving edits
  * 
  * REQUIRED ELEMENTS:
  *  - Keyword
  *  - Folder id that user is parent of
  *  - Reply body
  *  
  * @access protected
  * @return boolean
  */
 protected function _isValid()
 {
     if ($this->folderid) {
         if ($this->_user instanceof Application_Model_User && $this->_user->getId() && $this->_user->isParentOf($this->folderid)) {
             if ($this->replybody) {
                 return true;
             } else {
                 $this->setError('A keyword requires a auto response message');
             }
         } else {
             $this->setError('Permission denied');
         }
     } else {
         $this->setError('A keyword must be added to a folder');
     }
     return false;
 }
開發者ID:fniftaly,項目名稱:Java-Selenium,代碼行數:29,代碼來源:Keyword.php


注:本文中的Application_Model_User::isParentOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。