[Extension] Rights

I’ve used the rights extension before without any problems. Here is my current situation.

I am useing the Rights module in conjunction with the yii-user module (http://www.yiiframework.com/extension/yii-user/) setting them up as described here:

http://www.benjaminlhaas.com/blog/installing-yii-users-and-rights-5-steps

The difference between my other sites is that I have a admin or backend area set up as described here:

http://www.yiiframework.com/wiki/33/organize-directories-for-applications-with-front-end-and-back-end

I don’t need user and rights management for the front end, just the admin.

So in my root I have two files, index.php and admin.php. admin.php looks like this:




<?php

// change the following paths if necessary

$yii=dirname(__FILE__).'/yii/framework/yii.php';

$config=dirname(__FILE__).'/protected/admin/config/main.php';


// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',true);

// specify how many levels of call stack should be shown in each log message

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);


require_once($yii);

Yii::createWebApplication($config)->run();



My config file looks like this:




<?php


// uncomment the following to define a path alias

$admin=dirname(dirname(__FILE__));

$frontend=dirname($admin);

Yii::setPathOfAlias('admin', $admin);


// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(

	'basePath'=>$frontend,

	'name'=>'Site Name',


    'controllerPath' => $admin.'/controllers',

    'viewPath' => $admin.'/views',

    'runtimePath' => $admin.'/runtime',

    

	// preloading 'log' component

	'preload'=>array('log'),


	// autoloading model and component classes

	'import'=>array(

        	'admin.models.*',

        	'admin.components.*',

		'application.models.*',

		'application.components.*',

        	'application.modules.user.models.*',

        	'application.modules.user.components.*',

        	'application.modules.rights.*',

        	'application.modules.rights.components.*',

	),


	'modules'=>array(

            'user'=>array(

                'tableUsers' => 'users',

                'tableProfiles' => 'profiles',

                'tableProfileFields' => 'profiles_fields',

            ),

            'rights'=>array(

                'appLayout' => 'admin.views.layouts.main',

                'install'=>false,

            ),

	),


	// application components

	'components'=>array(

        'user'=>array(

                'class'=>'RWebUser',

                // enable cookie-based authentication

                'allowAutoLogin'=>true,

                'loginUrl'=>array('/user/login'),

        ),

        'authManager'=>array(

                'class'=>'RDbAuthManager',

                'connectionID'=>'db',

                'defaultRoles'=>array('Authenticated', 'Guest'),

        ),

......



My Controller looks like this:




class MyController extends Controller

{


	/**

	 * @return array action filters

	 */

	public function filters()

	{

        return array(

            'rights',

            'postOnly + delete', // we only allow deletion via POST request

        );

	}

.....



When running the controller I get the error:

"Filter "rights" is invalid. Controller "ApplicantController" does not have the filter method "filterrights"."

This has worked on every other site just fine. The Users and Rights work just fine, it’s just my controllers.

Any suggestions?

Nevermind, I found deciphered the solution in the Philippine forum

/protected/components/Controller.php should be:


class Controller extends RController

instead of


class Controller extends CController