首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >别名"rights.RightsModule“在Yii权限扩展中无效

别名"rights.RightsModule“在Yii权限扩展中无效
EN

Stack Overflow用户
提问于 2014-07-06 23:30:02
回答 1查看 319关注 0票数 0

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

代码语言:javascript
复制
 Alias "rights.RightsModule" is invalid. Make sure it points to an existing PHP file and the file is readable.  

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

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

代码语言:javascript
复制
<?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,
    ),
);  

这一切看起来都没问题,但却行不通。现在该怎么办?

EN

回答 1

Stack Overflow用户

发布于 2014-07-06 23:43:52

我注意到用户文件夹的权限是755,权限文件夹是700。这是一个只读文件夹。因此,我将权限改为755,并得到另一个关于找不到表的错误。下面的代码被添加到authManager section中,现在一切似乎都很正常。

代码语言:javascript
复制
'connectionID'=>'db',

这个答案可能会对其他人有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24597430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档