Using Rights Admin Has No Accxess To Page

Hi All,

I use yii-user and right for access to mu pages

I want that to my Category Controller user with Admin level has access, but user with "Operator" access level has NO access

My category page has url http://localhost/local-yii-tyb.com/tybapp/backend/category/index, with "backend/"


<?php

class CategoryController extends Controller

{

	public function filters()

	{

		return array(

			'rights',

		);

	}


	/*	public function allowedActions() // I comment this function

		{

			return 'index, edit, delete, find_category';

		}  */

...

?>



In /authItem/permissions page of my admin I see :

So nobody has access to "category/index", excepting Superadmin, but when I log to system as Admin(with superadmin=1) it also has no acccess too !

I try to debug tybapp/protected/modules/rights/components/RightsFilter.php file and see that :

that in code $authItem .= ucfirst($controller->id);

$authItem has value "Backend/category.Index", but in database I see in "authitem" table I see "Category.Index" value, not "Backend/" and first letter of "category" is small

letter. can it be reason of errror and how to fix it ?

Also please give some link to good expanations how these rights pages work, I have to guess somethimes…

In config :


'rights'=>array(

  'superuserName'=>'Admin', // Name of the role with super user privileges.

  'authenticatedName'=>'Authenticated',  // 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'=>true,  // Whether to use item description instead of name.

  'flashSuccessKey'=>'RightsSuccess', // Key to use for setting success flash messages.

  'flashErrorKey'=>'RightsError', // 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.

  'debug'=>false,


...


'authManager'=>array(

  'class'=>'RDbAuthManager',

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

  'connectionID'=>'db',

  'itemTable'=>'authitem',

  'itemChildTable'=>'authitemchild',

  'assignmentTable'=>'authassignment',

  'rightsTable'=>'rights',

),



Thanks!

Hi,

I think your CategoryController should extends from RController


class CategoryController extends RController{}

Thanks,

Aruna

Aruna, thank you for reply.

I made inheritence in my parent controller in tybapp/protected/components/Controller.php :


<?php

	/**

	 * Controller is the customized base controller class.

	 * All controller classes for this application should extend from this base class.

	 */

class Controller extends RController

{

	...

?>



So all controllers both in frontend and backend are inhereted from RController.

All controls in my backend app have links like /backend/category/index.

So I had in /protected/modules/rights/components/RightsFilter.php to make some changes :

when name of current control is read


$authItem .= ucfirst($controller->id);



It has value


"Backend/category.Index"

And I had to write some code to chage this value to :

"Category.Index" as it was set in Rigths/Permissions page(printscreen at first message).

It works in this way, but I do not think that it is the best way as :

  1. I have to edit source code of rights.

  2. If in frontend I had category/index control that would be confused.

But Rigths/Permissions page backend/category/index control anyway set as "Category.Index",

How better to make it ?