B
B
bagos2019-04-11 18:21:00
Yii
bagos, 2019-04-11 18:21:00

Can AccessControl behaviors be inherited?

Rbac is used for access control. In controllers on action and role, check matchCallback. Everything is available to the admin. It was required to make access restriction (behavior) for some controllers for all actions and roles of these controllers. The question is how to implement common behavior on these controllers? As I understand it, it will not be possible to inherit, for example, create a control for it to prescribe behavior, and then inherit it, it will be blocked. Create in base controller beforeAction with validation I need?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bay, 2019-04-11
@kawabanga

Try like this.

public function behaviors()
    {
        $behaviors = parent::behaviors(); // TODO: Change the autogenerated stub
        $behaviors['access']['rules'] =  // Ваш код доступов тут. 


        return $behaviors;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question