Alias" rights.RightsModule"在Yii版权扩展中无效

时间:2014-07-06 15:30:02

标签: yii yii-extensions rights

当我转到http://localhost/project/rights时,我收到以下错误:

 Alias "rights.RightsModule" is invalid. Make sure it points to an existing PHP file and the file is readable.  

我加倍检查了我的路径。我已经在modules文件夹中有用户扩展,它工作得很好。我在rights中提取了protected/modules/rights

这是我的config / main.php文件:

<?php
$sitedes = 'blah blah';
if($_SERVER['HTTP_HOST'] == 'localhost')
{
    $dbhost = 'localhost';
    $dbname = 'dbproject';
    $dbuser = 'root';
    $dbpass = '';
}

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'Project',
    'timeZone' => 'Asia/Somewhere',
    // preloading 'log' component
    'preload'=>array('log'),

    // autoloading model and component classes
    'import'=>array(
        'application.models.*',
        'application.components.*',
        'application.modules.user.models.*',
        'application.modules.user.components.*',
        'application.modules.rights.*',
        'application.modules.rights.components.*',
    ),

    'modules'=>array(

        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'gii',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters'=>array('127.0.0.1','::1'),
        ),

        'user'=>array(
            # encrypting method (php hash function)
            'hash' => 'md5',

            # send activation email
            'sendActivationMail' => true,

            # allow access for non-activated users
            'loginNotActiv' => false,

            # activate user on registration (only sendActivationMail = false)
            'activeAfterRegister' => false,

            # automatically login from registration
            'autoLogin' => true,

            # registration path
            'registrationUrl' => array('/user/registration'),

            # recovery password path
            'recoveryUrl' => array('/user/recovery'),

            # login form path
            'loginUrl' => array('/user/login'),

            # page after login
            'returnUrl' => array('/user/profile'),

            # page after logout
            'returnLogoutUrl' => array('/user/login'),
        ),

        'rights'=>array(
            'install'=>true,
        ),

    ),

    // application components
    'components'=>array(
        'user'=>array(
            'class'=>'RWebUser',    // Allows super users access implicitly.
        ),
        'authManager'=>array(
                'class'=>'RDbAuthManager',
        ),

        'urlManager'=>array(
            'urlFormat'=>'path',
            'showScriptName'=>false,
            'rules'=>array(
                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
        ),


        /*
        'db'=>array(
            'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
        ),
        */
        // uncomment the following to use a MySQL database

        'db'=>array(
            'connectionString' => 'mysql:host='.$dbhost.';dbname='.$dbname,
            'emulatePrepare' => true,
            'username' => $dbuser,
            'password' => $dbpass,
            'charset' => 'utf8',
            'tablePrefix' => 'fl_',
        ),

        'errorHandler'=>array(
            // use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
        'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error, warning',
                ),
                // uncomment the following to show log messages on web pages
                /*
                array(
                    'class'=>'CWebLogRoute',
                ),
                */
            ),
        ),
    ),

    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    'params'=>array(
        // this is used in contact page
        'adminEmail'=>'webmaster@example.com',
        'description'=>$sitedes,
    ),
);  

这一切似乎都可以,但它不起作用。现在该怎么办?

1 个答案:

答案 0 :(得分:0)

我注意到对于权限文件夹,用户文件夹的权限是755和700。这是一个只读文件夹。所以我将权限更改为755并得到另一个关于找不到表的错误。以下代码已添加到authManager section,现在一切似乎都运行正常。

'connectionID'=>'db',

这个答案可能有助于其他人。

相关问题