bigdropinc / yii2-ajax-access-rule
Ajax access rule for yii2 access filter
Installs: 231
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-11-15 20:47:22 UTC
README
Ajax access rule for yii2 access filter
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist bigdropinc/yii2-ajax-access-rule "*"
or add
bigdropinc/yii2-ajax-access-rule
to the require section of your composer.json
file.
Usage
For AccessControl rules use AjaxRule::className()
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'class' => AjaxRule::className(),
'actions' => ['some-action'],
'verbs' => ['POST'],
'allow' => true #this will allow only ajax requests for specified action
],
[
'class' => AjaxRule::className(),
'actions' => ['another-action'],
'allow' => false #this will allow only non-ajax request for specified action
],
]
]