Variable 'admin' User Name

In developing yii apps for SAAS use, the default name of admin is too common. I use email address for unique identifier and username can be duplicated. So, I want to reserve one admin user name for the overall admin of the application.

Today, I have to edit every controller from ‘users’=>array(‘admin’) to ‘users’=>array(‘admin-someCompanyName’).

Could gii make this a global variable for a one place change? I’m wondering if I should be moving to role base instead, yet one admin login is all I need for the application.

No thoughts on this? Maybe I should use a SU field in the user account DB and bag using the admin access.

Also, does this belong in 2.0 Discussion?


Have you tried setting that access rule in components/Controller.php instead? Since every controller you create extends from that file, that should make it global.

Thanks for this idea. I haven’t tried that. Would that just be the putting an access rule method in Controller.php? I saw some discussions where access rules in the Controller didn’t work as expected.

Lastly, would that be a global rule for each method across all controllers and would it override the ‘users’=>array(’*’) for each controller locally?


For my current project, I’m using the accessRules in the main Controlleritself without any problems.

To answer your 2nd question, yes. As long as you remove the accessRules from every controller, and have ‘accessControl’ set in that controllers filter.