V
V
vostotskiy2017-06-21 12:36:14
Yii
vostotskiy, 2017-06-21 12:36:14

How to make one action public in yii2 and the rest (without enumeration) available to registered users?

Hello.
I can't find documentation on one task of interest.
At the moment, in the controller, all actions are configured for access for the logged in user by the rule

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

I can't figure out how to make one action available to "?" public guest access, it is desirable not to list all the actions for the registered group.
I didn't find any examples in the documentation.
Thanks in advance for advice and tips.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2017-06-21
@vostotskiy

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

B
Boris Yakushev, 2017-06-21
@za4me

Bad search.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question