How to get users of a specefic role in Yii2 and DbManager?

b24 picture b24 · Aug 11, 2014 · Viewed 7.1k times · Source

How to get users of a specefic role in Yii2 and DbManager in RBAC?

Please introduce some API for user management and role management.

I searched and read Yii2 guide but I didn't find any solution.

Answer

mmonem picture mmonem · Oct 24, 2016

Since Yii version 2.0.7, DbManager and ManagerInterface which it implements have getUserIdsByRole($roleName) which does what you want without custom code.