protected function loadQueue($name, $authItems = [])
    {
        /** @var User */
        $user = Yii::$app->user;
        /** @var Queue */
        $queue = Yii::$app->get($name);
        if (!($queue instanceof components\QueueInterface)) {
            throw new NotFoundHttpException(Yii::t("app", 'Queue with given ID was not found.'));
        }
        $assignedAuthItems = [];
        $allowAccess = empty($authItems);
        foreach ($authItems as $authItem) {
            $assignedAuthItems[$authItem] = $user->can($authItem, ['queue' => $queue]);
            if ($assignedAuthItems[$authItem]) {
                $allowAccess = true;
            }
        }
        if (!$allowAccess) {
            throw new ForbiddenHttpException(Yii::t('yii', 'You are not authorized to perform this action.'));
        }

        return [$queue, $assignedAuthItems];
    }
protected function loadQueue($name, $authItems = [])
    {
        /** @var User */
        $user = Yii::$app->user;
        /** @var Queue */
        $queue = Yii::$app->get($name);
        if (!($queue instanceof components\QueueInterface)) {
            throw new NotFoundHttpException(Yii::t("app", 'Queue with given ID was not found.'));
        }
        $assignedAuthItems = [];
        $allowAccess = empty($authItems);
        foreach ($authItems as $authItem) {
            $assignedAuthItems[$authItem] = $user->can($authItem, ['queue' => $queue]);
            if ($assignedAuthItems[$authItem]) {
                $allowAccess = true;
            }
        }
        if (!$allowAccess) {
            throw new ForbiddenHttpException(Yii::t('yii', 'You are not authorized to perform this action.'));
        }

        return [$queue, $assignedAuthItems];
    }
protected function loadQueue ( $ name , $ authItems = [ ] ) { /** @var User */ $ user = Yii :: $ app -> user ; /** @var Queue */ $ queue = Yii :: $ app -> get ( $ name ) ; if ( ! ( $ queue instanceof components \ QueueInterface ) ) { throw new NotFoundHttpException ( Yii :: t ( "app" , 'Queue with given ID was not found.' ) ) ; } $ assignedAuthItems = [ ] ; $ allowAccess = empty ( $ authItems ) ; foreach ( $ authItems as $ authItem ) { $ assignedAuthItems [ $ authItem ] = $ user -> can ( $ authItem , [ 'queue' => $ queue ] ) ; if ( $ assignedAuthItems [ $ authItem ] ) { $ allowAccess = true ; } } if ( ! $ allowAccess ) { throw new ForbiddenHttpException ( Yii :: t ( 'yii' , 'You are not authorized to perform this action.' ) ) ; } return [ $ queue , $ assignedAuthItems ] ; }
Loads queue specified by id and checks authorization.
@param  string $name queue component name
@param  array $authItems
@return array QueueInterface object and array with authItems as keys and boolean values
@throws ForbiddenHttpException
@throws NotFoundHttpException
Loads queue specified by id and checks authorization .