【发布时间】:2015-05-05 14:27:23
【问题描述】:
我已经安装了yii权限扩展,这是我安装后的代码,安装后创建了数据库表。
'modules'=>array(
// uncomment the following to enable the Gii tool
'rights'=>array(
'superuserName'=>'Admin', // Name of the role with super user privileges.
'authenticatedName'=>'Authenticated', //// Name of the authenticated user role.
'userIdColumn'=>'id',// Name of the user id column in the database.
'userNameColumn'=>'username', // Name of the user name column in the database.
'enableBizRule'=>true, // Whether to enable authorization item business rules.
'enableBizRuleData'=>false, //Whether to enable data for business rules.
'displayDescription'=>true, // Whether to use item description instead of name. '
// Key to use for setting success flash messages.
'flashErrorKey'=>'RightsError',
/ Key to use for setting error flash messages.
// 'install'=>true, // Whether to install rights.
'baseUrl'=>'/rights', // Base URL for Rights. Change if module is nested.
'layout'=>'rights.views.layouts.main', // Layout to use for displaying Rights.
'appLayout'=>'application.views.layouts.main', //Application layout.
'cssFile'=>'rights.css', // Style sheet file to use for Rights. '
'install'=>false, // Whether to enable installer.
'debug'=>false,
),
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'1234',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
),
但是当我输入 url http://localhost/rightsTest/index.php/rights 然后它说
Error 403
There must be at least one superuser!
我尝试了很多东西,但找不到答案。感谢您的帮助。
【问题讨论】:
-
您是否检查了您指定为超级用户的帐户是否确实存在?也许在您的数据库中它被称为“admin”而不是“Admin”。
-
我没听懂你,你说的是哪个数据库表?我认为它的这个扩展在数据库中创建了 4 个表。 Authassignment,authitem,authitemchild,权利。请问你说的是哪张桌子?
-
好吧,你在某处有一个用户表——毕竟所有用户数据都必须从某处提取。我所说的就是那个信息来源。
-
是的,我有一个用户表,我已经检查过了,同样的错误 403 发生了。
-
顺便说一句,权限的创建者创建了另一个应用程序来处理比权限更少的错误和更灵活的授权:github.com/Crisu83/yii-auth