I
I
IvanOne2014-09-18 22:45:53
Yii
IvanOne, 2014-09-18 22:45:53

How to implement simple storage of roles in yii?

Good day friends! I want to store roles in the database in yii and assign these roles to specific users during authentication, RBAC seemed too big for such a task, the only question is how to assign roles during authentication so that they can then be checked in accessControl. I apologize if the question is simple, but the head no longer cooks and a solution is required!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2014-09-18
@IvanOne

If I remember correctly, it's like this

'operator' => array(
        'type' => CAuthItem::TYPE_ROLE,
        'description' => 'Оператор',
        'children' => array(
            'user',
        ),
        'bizRule' => "Yii::app()->user->getRole() == 'operator'",
        'data' => null
    ),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question