src/controllers/RbacManageController.php
public function actionRemoveItems()
    {
        if (false === Yii::$app->request->isAjax) {
            throw new NotFoundHttpException(Yii::t('users', 'Page not found'));
        }
        $type = Yii::$app->request->post('item-type', 0);
        self::checkPermissions($type);
        $items = Yii::$app->request->post('items', []);
        $authManager = Yii::$app->getAuthManager();
        $removed = 0;
        foreach ($items as $item) {
            try {
                $authManager->remove(new Item(['name' => $item]));
                $removed++;
            } catch (\Exception $e) {
                Yii::$app->session->setFlash(
                    'warning',
                    Yii::t('users', "Unknown RBAC item name '{name}'", ['name' => $item])
                );
            }
        }
        if (0 !== $removed) {
            Yii::$app->session->setFlash(
                'info',
                Yii::t('users', "Items removed: {count}", ['count' => $removed])
            );
        }
    }
public function actionRemoveItems()
    {
        if (false === Yii::$app->request->isAjax) {
            throw new NotFoundHttpException(Yii::t('users', 'Page not found'));
        }
        $type = Yii::$app->request->post('item-type', 0);
        self::checkPermissions($type);
        $items = Yii::$app->request->post('items', []);
        $authManager = Yii::$app->getAuthManager();
        $removed = 0;
        foreach ($items as $item) {
            try {
                $authManager->remove(new Item(['name' => $item]));
                $removed++;
            } catch (\Exception $e) {
                Yii::$app->session->setFlash(
                    'warning',
                    Yii::t('users', "Unknown RBAC item name '{name}'", ['name' => $item])
                );
            }
        }
        if (0 !== $removed) {
            Yii::$app->session->setFlash(
                'info',
                Yii::t('users', "Items removed: {count}", ['count' => $removed])
            );
        }
    }
public function actionRemoveItems ( ) { if ( false === Yii :: $ app -> request -> isAjax ) { throw new NotFoundHttpException ( Yii :: t ( 'users' , 'Page not found' ) ) ; } $ type = Yii :: $ app -> request -> post ( 'item-type' , 0 ) ; self :: checkPermissions ( $ type ) ; $ items = Yii :: $ app -> request -> post ( 'items' , [ ] ) ; $ authManager = Yii :: $ app -> getAuthManager ( ) ; $ removed = 0 ; foreach ( $ items as $ item ) { try { $ authManager -> remove ( new Item ( [ 'name' => $ item ] ) ) ; $ removed ++ ; } catch ( \ Exception $ e ) { Yii :: $ app -> session -> setFlash ( 'warning' , Yii :: t ( 'users' , "Unknown RBAC item name '{name}'" , [ 'name' => $ item ] ) ) ; } } if ( 0 !== $ removed ) { Yii :: $ app -> session -> setFlash ( 'info' , Yii :: t ( 'users' , "Items removed: {count}" , [ 'count' => $ removed ] ) ) ; } }
Respond only on Ajax

@throws NotFoundHttpException
Respond only on Ajax