M
M
My joy2018-02-12 14:26:40
Yii
My joy, 2018-02-12 14:26:40

How to unbind all roles from a user?

Hi friends!
When reassigning a role to a user, it is necessary to untie all the roles that he currently has (this is required by the application architecture). There is an assign() method, but I didn't find an unsign method or similar.
Of course, there is an option to simply cut out the entries from the auth_assignment table, but suddenly a more elegant solution for this was lying around in yii. Who knows?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OKyJIucT, 2018-02-12
@t-alexashka

There is such a method, it is called revokeAll($user_id)
www.yiiframework.com/doc-2.0/yii-rbac-managerinter...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question