Difference between #9 and #10 of
CPhpAuthManager - how it works, and when to use it

Revision #10 has been created by François Gannaz on Nov 23, 2011, 11:04:57 PM with the memo:

(m) Fixed a few English mistakes
« previous (#9)


Title unchanged

CPhpAuthManager - how it works, and when to use it

Category unchanged


Yii version unchanged

Tags unchanged

CPhpAuthManager, rbac, accessControl, roles, admin, moderator, guest, banned

Content changed

Introduction ------------ Before rieading this article, you should first learn this [How to setup RBAC with a php file](http://www.yiiframework.com/wiki/65/how-to-setup-rbac-with-a-php-file "")

It is actually mentioned in the documentation
<quote>CPhpAuthManager is mainly suitable for authorization data that is not too big (for example, the authorization data for a personal blog system). Use CDbAuthManager for more complex authorization data.</quote>

So you maybe mistakenly thought it
iwas perfect and willould allow you to manage the roles of the next website with million users, and it doesn't ... BUT there are ways to improve it actually, if your hierarchy structure is simple, so you can serve up to million users with it .

Why CPhpAuthManager can be evil?
At the first glance what is the problem? You set auth.php file, it has the rules - no problems.

But actually when you dig d
ipeeper you understand there is a lot of issues with it .

Lets take a look at the [CPhpAuthManager::assign](http://www.yiiframework.com/doc/api/1.1/CPhpAuthManager#assign-detail "")
If you follow this rules, if you have 1 million of users.
You will have about 100 moderators and few admins... so it is peace of cake for CPhpAuthManager if you follow the rules
. You just need to remember that for every role assignment hou have to add row to your auth.php file that is loaded every time! Addition1 --------- I described the issue, but it is always better to do it yourself to understand in more depth what is the "problem" with it. And don't understand me wrong... it is awesome! but it not meant to work with a lot of users and assignments!. jJust do this loop after you set the basic rules in auth.php

$auth = Yii::app()->authManager;

execute it and after this open the
1 2
Viewed: 24 996 times
Version: 1.1
Category: How-tos
Written by: dckurushin
Last updated by: François Gannaz
Created on: Oct 12, 2011
Last updated: 6 years ago
Update Article


View all history