I spent the last two days trying to figure this out…it’s not clear in the article I was reading where the issue was.
If you go to this link and read about CDbAuthManager::assign() the example code makes it seem like you need to assign roles to users using their usernames. However, that isn’t what I’ve seen. Instead, you need to assign based on the userID. If you’ve overwritten getId() in your UserIdentity class to return a numeric index, then that is what you need to use to assign roles–NOT the username.
I’m still testing to make sure this is the case, but the documentation doesn’t mention this possibility, and I’ve had to spend a lot of time trying to discover why I was never authorized.
$auth->assign('admin','cesig'); //FAIL...Not authorized $auth->assign('admin',1); //worked