当前位置: 首页>>代码示例>>PHP>>正文


PHP AccessControl::className方法代码示例

本文整理汇总了PHP中yii\filters\AccessControl::className方法的典型用法代码示例。如果您正苦于以下问题:PHP AccessControl::className方法的具体用法?PHP AccessControl::className怎么用?PHP AccessControl::className使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\filters\AccessControl的用法示例。


在下文中一共展示了AccessControl::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: behaviors

 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'except' => ['signup', 'signin', 'member', 'index', 'login', 'logout', 'createmenu', 'enter', 'main', 'detaile', 'step1', 'step2', 'reg', 'dosignin', 'forgot', 'forgotstep1', 'forgotfinish', 'bindcard', 'about', 'help', 'contact', 'safety', 'gindex', 'gshare', 'gsignup', 'dorecharge', 'productlist'], 'rules' => [['allow' => true, 'roles' => ['@']]], 'denyCallback' => function () {
         \Yii::$app->getSession()->setFlash("errors", ['info' => '']);
         return $this->redirect(Url::to(['site/signin']));
     }]];
 }
开发者ID:wuwenhan,项目名称:huoqiwang,代码行数:7,代码来源:FrontendController.php

示例2: 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']]]];
 }
开发者ID:rvences,项目名称:mopoua,代码行数:10,代码来源:TipoingresoegresoController.php

示例3: 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;
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:10,代码来源:UserController.php

示例4: 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]);
     }]]]];
 }
开发者ID:obedkin,项目名称:atlant,代码行数:7,代码来源:DefaultController.php

示例5: 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'],
             ],
         ],
     ];
 }
开发者ID:seans888,项目名称:SMF-Project,代码行数:28,代码来源:SiteController.php

示例6: 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]);
     }]];
 }
开发者ID:rocketyang,项目名称:admap,代码行数:10,代码来源:AdverController.php

示例7: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'except' => ['get-captcha', 'signup', 'signin', 'signup-verify', 'login', 'off', 'enter', 'pay-notify', 'notify', 'list', 'view', 'wechat', 'create-menu'], 'rules' => [['allow' => true, 'roles' => ['@']]], 'denyCallback' => function () {
         wanhunet::$app->getSession()->setFlash("errors", ['info' => '请先登录']);
         return $this->redirect(Url::to(['site/signin']));
     }]];
 }
开发者ID:suyuanen,项目名称:p2p,代码行数:10,代码来源:FrontendController.php

示例8: 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'],
             ],
         ],
     ];
 }
开发者ID:seans888,项目名称:SMF-Project,代码行数:30,代码来源:SiteController.php

示例9: behaviors

    public function behaviors(){

        $behaviors = [
            'access' => [
                'class' => AccessControl::className(),
                'rules' => [
                    [
                        'allow' => true,
                        'roles' => ['@']
                    ]
                ]
            ],

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


        return $behaviors;

    }
开发者ID:scorp7mix,项目名称:yii,代码行数:25,代码来源:AuthController.php

示例10: behaviors

 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'ruleConfig' => ['class' => AccessRule::className()], 'rules' => [['allow' => true, 'roles' => [UserCadastro::ROLE_ADMIN]]]]];
     //            [ 'access' => [
     //                'class' => AccessControl::className(),
     //                'only' => ['index', 'view'],
     //                'rules' => [
     //                    [
     //                        'actions' => ['index','view'],
     //                        'allow' => true,
     //                        'roles' => ['@'],
     //                    ],
     //
     //                ],
     //            ],
     //				'verbs' => [
     //						'class' => VerbFilter::className (),
     //						'actions' => [
     //								'delete' => [
     //										'post'
     //								]
     //						]
     //				]
     //		];
 }
开发者ID:dieos2,项目名称:bolaoyyi2,代码行数:25,代码来源:UserController.php

示例11: behaviors

 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'denyCallback' => function ($rule, $action) {
         \Yii::$app->user->logout();
         $this->redirect(['/users/backend/login']);
     }, 'rules' => [['actions' => ['error'], 'allow' => true], ['actions' => ['index'], 'allow' => true, 'roles' => ['manager', 'admin']]]]];
 }
开发者ID:andreosoft,项目名称:andreocms,代码行数:7,代码来源:BackendController.php

示例12: behaviors

 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behavior = ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => [wanhunet::$app->controller->getRoute()]]], 'denyCallback' => function ($rule, $action) {
         throw new ForbiddenHttpException();
     }]];
     return ArrayHelper::merge($behavior, parent::behaviors());
 }
开发者ID:suyuanen,项目名称:p2p,代码行数:10,代码来源:BackendController.php

示例13: 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']]]];
 }
开发者ID:kodiers,项目名称:yii2build,代码行数:7,代码来源:UpgradeController.php

示例14: 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'));
     }]];
 }
开发者ID:pham186,项目名称:yii2,代码行数:7,代码来源:PostController.php

示例15: behaviors

 /**
  * Returns a list of behaviors that this component should behave as.
  * Here we use RBAC in combination with AccessControl filter.
  *
  * @return array
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['index', 'view', 'create', 'update', 'delete', 'admin'], 'allow' => true, 'roles' => ['editor', 'admin'], 'denyCallback' => function ($rule, $action) {
         return $this->redirect('/', 301);
     }], []]]];
     // return
 }
开发者ID:nmb007,项目名称:excursion,代码行数:13,代码来源:PostController.php


注:本文中的yii\filters\AccessControl::className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。