示例#1
0
 /**
  * Returns a value indicating whether the filer is active for the given action.
  * @param Action $action the action being filtered
  * @return boolean whether the filer is active for the given action.
  */
 protected function isActive($action)
 {
     $uniqueId = $action->getUniqueId();
     if ($uniqueId === Yii::$app->getErrorHandler()->errorAction) {
         return false;
     } else {
         if (Yii::$app->user->isGuest && Yii::$app->user->loginUrl == $uniqueId) {
             return false;
         }
     }
     return parent::isActive($action);
 }
示例#2
0
 /**
  * Returns a value indicating whether the filer is active for the given action.
  * @param Action $action the action being filtered
  * @return boolean whether the filer is active for the given action.
  */
 protected function isActive($action)
 {
     if ($this->owner instanceof Module) {
         // convert action uniqueId into an ID relative to the module
         $mid = $this->owner->getUniqueId();
         $id = $action->getUniqueId();
         if ($mid !== '' && strpos($id, $mid) === 0) {
             $id = substr($id, strlen($mid) + 1);
         }
     } else {
         $id = $action->id;
     }
     return !in_array($id, $this->except, true) && (empty($this->only) || in_array($id, $this->only, true));
 }
示例#3
0
 /**
  * Returns an action ID by converting [[Action::$uniqueId]] into an ID relative to the module
  * @param Action $action
  * @return string
  * @since 2.0.7
  */
 protected function getActionId($action)
 {
     if ($this->owner instanceof Module) {
         $mid = $this->owner->getUniqueId();
         $id = $action->getUniqueId();
         if ($mid !== '' && strpos($id, $mid) === 0) {
             $id = substr($id, strlen($mid) + 1);
         }
     } else {
         $id = $action->id;
     }
     return $id;
 }