权限模块使用不同的应用程序实例

时间:2013-04-23 09:09:26

标签: yii rights

我正在开发一个Yii应用程序,它使用几个模块,包括用于访问控制的权限模块。它们都驻留在相同的“modules”文件夹中,并在同一个config / main.php文件中配置。应用程序只有一个输入脚本。

但是我注意到Rights模块使用不同的应用会话,而所有其他模块使用另一个应用会话。由于这个原因,用户会话不与权利共享。

有没有人遇到yii模块的问题?请帮忙。谢谢!

我的配置文件:

'rights'=>array(
            'debug' => true,
            'superuserName'         => 'Super Administrator', // Name of the role with super user privileges.                       
            'authenticatedName'     => 'Customer', // 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'     => true, // Whether to enable data for business rules.
            'displayDescription'    => false, // Whether to use item description instead of name.
            'flashSuccessKey'       => 'success', // Key to use for setting success flash messages.
            'flashErrorKey'         => 'error', // Key to use for setting error flash messages.
            //'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.
        ),

1 个答案:

答案 0 :(得分:0)

尝试了两天后,我找到了解决方案。

我注意到它在系统中使用了两个不同的密钥前缀(stateKeyPrefix)。一个用于权利,另一个用于其他模块。这可以配置为在主配置文件中使用单键前缀。

'user'=>array(
            'class'=>'RWebUser',
            'allowAutoLogin'=>true, // enable cookie-based authentication
            'stateKeyPrefix'=>'f298d9729c7408c3d406db95a9639204', // some random value
    ),

希望这可以帮助有同样问题的人。