Behaviour of a controller

Learning about behaviour of a controller.

In this controller, I got a lot of action that should be access after login. How can I make one special action in this controller without login ?

I just try it, not succces. This is my code.


class RequestController extends Controller {

public function behaviors() {

 return [

  'verbs' => [

      'class' => VerbFilter::className(),

      'actions' => [

      'delete' => ['post'],

      'bulk-delete' => ['post'],

    ],

  ],


  'access' => [

      'class' => AccessControl::className(),

      'only' => ['approve'], /*Special action*/

      'rules' => [

          [

              'actions' => ['approve'],

              'allow' => true,

              'roles' => ['?'],

          ],

      ],

  ],

];

}

Please advise.

Restrict access except for the action you want open.




'access' => [

                'class' => AccessControl::className(),

                'except' => ['approve'],

                'rules' => [

                    [

                        'allow' => true,

                        'roles' => ['@'],

                    ],

                ],

            ],