getIsAdmin working with Role not only hard-coded username

64 views
Skip to first unread message

Ilko Kacharov

unread,
Mar 29, 2013, 8:16:46 AM3/29/13
to yii-...@googlegroups.com
Hi there,

What's the best way to extend the yii-auth functionality so I can have a Admin role instead of only one hard-coded username 'admin'.

This will be more functional in my case.

Regards,
Ilko

Christoffer Niska

unread,
Mar 29, 2013, 8:22:43 AM3/29/13
to Ilko Kacharov, yii-auth

Extend AuthWebUser and override init to set isAdmin by calling checkAccess('Admin') where Admin is the name of the admin role. I like to keep so called superusers outside of the rbac completely but this would work for you.

-Christoffer

--
You received this message because you are subscribed to the Google Groups "yii-auth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yii-auth+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ilko Kacharov

unread,
Mar 29, 2013, 11:02:20 AM3/29/13
to yii-...@googlegroups.com
Many thanks!

This will do the job!

Ilko Kacharov

unread,
Mar 29, 2013, 11:05:27 AM3/29/13
to yii-...@googlegroups.com
What will happen if there is a Task or Operation with the same name as the Role ? 
Which one will be checked first and how it will result if the Role is not assigned but the Task/Operation is?

Thanks

Christoffer Niska

unread,
Mar 30, 2013, 2:30:30 AM3/30/13
to Ilko Kacharov, yii-auth

There cannot be. The authName in the AuthItem table is unique.

--
Reply all
Reply to author
Forward
0 new messages