コード例 #1
0
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     //set response header to application/json only
     $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
     $behaviors['ipFilter'] = ['class' => IPFilter::className()];
     $behaviors['tokenFilter'] = ['class' => TokenFilter::className()];
     $behaviors['openPollFilter'] = ['class' => OpenPollFilter::className()];
     // $behaviors['verbs'] = [
     //     'class' => VerbFilter::className(),
     //     'actions' => [
     //         'submit' => ['get'],
     //         'get' => ['get'],
     //     ],
     // ];
     return $behaviors;
 }
コード例 #2
0
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['index', 'voting', 'expire'], 'allow' => true], ['actions' => ['preview'], 'roles' => ['@'], 'allow' => true]]], 'access' => ['class' => AccessControl::className(), 'only' => ['preview'], 'rules' => [['allow' => true, 'roles' => ['@']]], 'ruleConfig' => ['class' => OrganizationAccessRule::className()]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]], 'ipFilter' => ['class' => IPFilter::className()], 'tokenFilter' => ['class' => TokenFilter::className(), 'except' => ['index', 'preview', 'expire']], 'openPollFilter' => ['class' => OpenPollFilter::className(), 'except' => ['index', 'preview', 'expire']]];
 }