Exemple #1
0
 /**
  * Performs access check for the specified user.
  * This method is internally called by [[checkAccess()]].
  *
  * @param Assignable $user the user.
  * @param string $itemName the name of the operation that need access check.
  * @param array $params name-value pairs that would be passed to rules associated.
  * with the permissions and roles assigned to the user.
  * @param array $assignments the list of permissions and roles, assigned to the specified user.
  * @return boolean whether the operations can be performed by the user.
  */
 protected function checkAccessRecursive(Assignable $user, $itemName, $params, $assignments)
 {
     if (!isset($this->items[$itemName])) {
         return false;
     }
     /* @var $item Item */
     $item = $this->items[$itemName];
     if (!$this->executeRule($user, $item, $params)) {
         return false;
     }
     if (in_array($itemName, $assignments)) {
         return true;
     }
     foreach ($this->items->getChildren() as $parentName => $children) {
         if (isset($children[$itemName]) && $this->checkAccessRecursive($user, $parentName, $params, $assignments)) {
             return true;
         }
     }
     return false;
 }
Exemple #2
0
 /**
  * @return Item array
  */
 public function getControllers()
 {
     return $this->items->getControllers();
 }