konapaz
(Konapaz)
1
Hi
Is there a simple to get an array of roles from Yii::app()->authManager ?
something like that Yii::app()->authManager->getAllRoles() (not from specific user)
or I have to fetch all data by sql query ?
I create administrator panel and I want the admin to assign roles to other members
An way is
$connection=Yii::app()->db;
$command=$connection->createCommand("select name from authitem where type=2");
$dataReader=$command->queryAll();
I don’t want third part - extensions
Thanks
ronald58
(Yii)
2
Why not use Yii::app()->authManager->getRoles() ?
konapaz
(Konapaz)
3
I really forgot that!
Also I think that Yii::app()->authManager->getRoles
requires the user id but this is optional!
(like Yii::app()->authManager->getRoles(Yii::app()->user->id) )
$roles = Yii::app()->authManager->getRoles();
$list=array();
foreach ($roles as $key=>$val) {
$list[] = $key;
}
thanks Ronald! 