yii2: yii\web\VerbFilter (not a bug)

Is posible to allow all the Controller's actions only for POST request, without enumerating all this ones in actions array? Something like:

'verbs' => [
     'class' => VerbFilter::className(),
     'actions' => [
        '*' => ['post']
     ]
]

If not, why?

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 23 (20 by maintainers)

Most upvoted comments

@vova07 It is possible with AccessControl:

public function behaviors()
{
    return [
        'access' => [
            'class' => \yii\web\AccessControl::className(),
            'rules' => [
                [
                    'allow' => true,
                    'verbs' => ['POST']
                ],
        ],
    ];
}

@cebe it seems VerbFilter has functionality that partially duplicates what can be done with AccessControl except status code is different.