rbac

Yii Framework添加Srbac模块的步骤

作者:feebas 发布于:2012-4-23 13:30 Monday 分类:Yii Framework

第一步,下载Srbac,下载地址:http://www.yiiframework.com/extension/srbac/;
第二步,解压至protected/modules/srbac;
第三步,配置config/main.php,如下:

'import'=>array(
    'application.models.*',
    'application.components.*',
    'application.extensions.*',
    'application.modules.srbac.controllers.SBaseController',
),
'components'=>array(
    'user'=>array(
        // enable cookie-based authentication
        'allowAutoLogin'=>true,
    ),
    'authManager'=>array(
        'class'=>'CDbAuthManager',
        'connectionID'=>'db',
        'itemTable'=>'items',
        'assignmentTable'=>'assignments',
        'itemChildTable'=>'itemchildren',
    ),
    'db'=>array(
        'connectionString' => 'mysql:host=localhost;dbname=cms',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => '123456',
        'charset' => 'utf8',
    ),
),
 'modules'=>array(
        'srbac' => array(
        'userclass'=>'User',
        'userid'=>'id',
        'username'=>'username',
        'debug'=>true,
        'pageSize'=>10,
        'superUser' =>'Authority',
        'css'=>'srbac.css',
        'layout'=>'application.views.layouts.main',
        'notAuthorizedView'=>'srbac.views.authitem.unauthorized',
        'alwaysAllowed'=>array('SiteLogin','SiteLogout','SiteIndex','SiteAdmin','SiteError', 'SiteContact'),
        'userActions'=>array('Show','View','List'),
        'listBoxNumberOfLines' => 15,
        'imagesPath' => 'srbac.images',
        'imagesPack'=>'noia',
        'iconText'=>true,
        'header'=>'srbac.views.authitem.header',
        'footer'=>'srbac.views.authitem.footer',
        'showHeader'=>true,
        'showFooter'=>true,
        'alwaysAllowedPath'=>'srbac.components',
    ),
),
第四步,打开浏览器,输入/path/to/application/index.php?r=srbac进行安装.

posted @ 2013-04-26 18:52  jason&li  阅读(158)  评论(0编辑  收藏  举报