php - What does superuser mean in the rights-extension of Yii?
270
I am using the rights extension of Yii and get this error:
There must be at least one superuser!
I don't know what thissuperuser
means since I am using the default authentication with user admin and demo. After reading the documentation of rights extension, I tried to configure rights with:
'rights'=>array(
'superuserName'=>'admin',
'install'=>true
),
But it doesn't work, I have searched the internet but got no result.
Answer
Solution:
you need to connect the user table with a table AuthAssignment, whose name has been declared in the array setting
then, you have to change the table AuthAssignment userid field that refer to field id on table user
Answer
Solution:
If you have installed user and rights like here, Just run this in your database:
Note: In the tutorial all table names of rights module are in lower case.
Answer
Solution:
The naming is a bit misleading, I stumbled upon that problem also.
superuserName
should be namedsuperuserRole
, meaning that all users which are assigned to the role specified there are super-users.Please note that
Yii::app()->user->checkAccess('whatever')
will alwaysreturn true
for super-users.See also RAuthorizer.php:
and RWebUser.php.
Answer
Solution:
FWIW (since it's been so long), you have to grant one of your users the superuser role.
That role name is denoted in the
superuserName
property in the config file, as shown in your post. This can be done directly via SQL, by updating theauthAssignment
table (its name may be different in your case, it is configurable).Then, log in as the appropriate user (the one corresponding to id #1, in this particular case).
Answer
Solution:
there's a small hack, line you have to comment out for it to work...
check official extension page comments
EDIT: I didn't want to post a link to my own blog because it looks like self-promoting but it's a very comprehensive solution to your problem I think : installing yii-rights extension
Answer
Solution:
i think you have to use mysql database and table user not default authentication -it is just a example of authentication-. after you import user table you should add a user with username "admin" -if u have "admin" in superuserName config- in user table.
Answer
Solution:
I managed to install it by following a post on the yii-forums - here is a permalink to my post: http://www.yiiframework.com/forum/index.php/topic/10556-extension-rights/page__view__findpost__p__229721