本文整理汇总了PHP中yii\filters\VerbFilter类的典型用法代码示例。如果您正苦于以下问题:PHP VerbFilter类的具体用法?PHP VerbFilter怎么用?PHP VerbFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VerbFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: behaviors
/**
* @inheritdoc
*/
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['access']['rules'] = array_merge([['actions' => ['login'], 'allow' => true, 'roles' => ['?']], ['actions' => ['login'], 'allow' => false, 'roles' => ['@']], ['actions' => ['logout'], 'allow' => true, 'roles' => ['@']], ['actions' => ['logout'], 'allow' => false, 'roles' => ['?']]], $behaviors['access']['rules']);
$behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]];
return $behaviors;
}
示例2: behaviors
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'only' => ['logout', 'signup'],
'rules' => [
[
'actions' => ['signup'],
'allow' => true,
'roles' => ['@'],
],
[
'actions' => ['logout'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
}
示例3: behaviors
public function behaviors()
{
return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]], 'access' => ['class' => AccessControl::className(), 'only' => ['create', 'update'], 'rules' => [['actions' => ['create'], 'allow' => true, 'roles' => ['user']], ['actions' => ['update'], 'allow' => true, 'matchCallback' => function ($rule, $action) {
$model = $this->findModel(Yii::$app->getRequest()->get('id'));
return Yii::$app->getUser()->can('updateNews', ['model' => $model]);
}]]]];
}
示例4: behaviors
/**
* @inheritdoc
*/
public function behaviors()
{
return ['access' => ['class' => AccessControl::className(), 'only' => ['index', 'delete'], 'rules' => [['allow' => true, 'actions' => ['index', 'delete'], 'roles' => ['@'], 'matchCallback' => function () {
//Llamada al método que comprueba si es un vendedor
return \common\models\User::isUserAdmin(Yii::$app->user->identity->id);
}]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['POST']]]];
}
示例5: behaviors
/**
* @inheritdoc
*/
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['access'] = ['class' => AccessControl::className(), 'rules' => [['actions' => ['sign-in', 'sign-up', 'forgot', 'error'], 'allow' => true], ['actions' => ['sign-out', 'update', 'view'], 'allow' => true, 'roles' => ['@']]]];
$behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['sign-out' => ['post']]];
return $behaviors;
}
示例6: behaviors
/**
* {@inheritDoc}
*/
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
$behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['*' => ['GET', 'AJAX'], 'file-upload' => ['POST', 'AJAX']]];
return $behaviors;
}
示例7: behaviors
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['login', 'error'],
'allow' => true,
],
[
'actions' => ['logout', 'index'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['get'],
],
],
];
}
示例8: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['indexWithQuote' => ['get']]];
$behaviors['authenticator'] = ['class' => HttpBasicAuth::className()];
return $behaviors;
}
示例9: behaviors
public function behaviors(){
$behaviors = [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@']
]
]
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
return $behaviors;
}
示例10: behaviors
public function behaviors()
{
if (Yii::$app->user->identity->type == 'normal') {
return $this->goBack();
}
return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]];
}
示例11: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['rateLimiter'] = ['class' => RateLimiter::className(), 'only' => ['view']];
$behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['view' => ['get'], 'countries' => ['get'], 'cities' => ['get']]];
return $behaviors;
}
示例12: behaviors
public function behaviors()
{
// return parent::behaviors(); // TODO: Change the autogenerated stub
return ['access' => ['class' => \yii\filters\AccessControl::className(), 'only' => ['index'], 'rules' => [['actions' => ['index'], 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) {
return PermissionHelpers::requireStatus('Active');
}]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]];
}
示例13: behaviors
public function behaviors()
{
return ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]], 'access' => ['class' => AccessControl::className(), 'only' => ['index', 'create', 'update', 'delete'], 'rules' => [['allow' => true, 'actions' => ['index', 'create', 'update', 'delete'], 'roles' => ['@']]], 'denyCallback' => function ($rule, $action) {
return $this->redirect(['/site/login']);
throw new HttpException(403, Yii::t('yii', 'Login Required'));
}]];
}
示例14: behaviors
/**
* @inheritdoc
*/
public function behaviors()
{
return ['verbs' => ['class' => VerbFilter::className(['send']), 'actions' => ['delete' => ['POST']]]];
/* return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
/* Author: -ptr.nov- : Permission Allow No Login |index|error|login */
/* 'actions' => ['index', 'error','login','subcat','site'],
'allow' => true,
],
[
'actions' => ['logout', 'index','subcat','site'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
*/
}
示例15: behaviors
/**
* @inheritdoc
*/
public function behaviors()
{
return ['access' => ['class' => AccessControl::className(), 'except' => ['index', 'error'], 'rules' => [['allow' => true, 'roles' => ['@']], ['allow' => true, 'actions' => ['download-attachment', 'index', 'search-cluster', 'search-marker', 'info-window', 'view', 'qr-code', 'error'], 'roles' => ['?']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post'], 'attachment-delete' => ['post'], 'gallery-delete' => ['post']]], ['class' => 'yii\\filters\\HttpCache', 'only' => ['view'], 'etagSeed' => function ($action, $params) {
$model = $this->findModel((int) Yii::$app->request->get('id'));
return serialize([$model->id, $model->updated_at]);
}]];
}