[EXTENSION] srbac : Web interface for the administration of rbac

is ‘layout’=>‘application.views.layouts.admin’, points to a real layout file?If you don’t use a different layout for the srbac comment the layout attribute.

Just for test comment the urlManager rules and check if index.php?r=srbac works

Always the same don’t find srbac :S

Is the srbac version you use compatible with your Yii version?

srbac 1.0.3 is for Yii 1.0.x and srbac 1.1 RC1 for Yii 1.1.x

I could but it affects whole application including other modules etc. so in fact I can’t :)

I can also overwrite SBaseController::beforeAction() but I dont like duplicating code - IMHO it’s a bug and the line:




if(!Yii::app()->user->checkAccess($access) || Yii::app()->user->isGuest) {



should be changed to




if(!Yii::app()->user->checkAccess($access)) {



Part of "if":


 || Yii::app()->user->isGuest

is blocking Guest user even when this user has access to action. Removing it doesnt change anything in current access settings but makes yii<->srbac mole flexible.

BTW, Valor sounds great :]




<?php 

if(!Yii::app()->user->checkAccess($access) || Yii::app()->user->isGuest) {

  $this->onUnauthorizedAccess();

} else {

  return true;

}

?>



!Yii::app()->user->checkAccess($access) => false if user has access

Yii::app()->user->isGuest => false if the user is not guest

So => the check is passed and user gets access

if checkAccess() is false , or user is guest !Yii::app()->user->checkAccess($access) or Yii::app()->user->isGuest evaluates to true and $this->onUnauthorizedAccess() is invoked, meaning no access

Maybe overriding the method is the best option for your case or adding a new attribute grantGuestAccess = true to bypass guest checking

Thanks :)

nothing to do I have tried both srbac version but the response is always the same

have you copied srbac to the modules directory?

so it’s like:

protected/modules/srbac/

Yes It’s very strange thing.

What;s the exact error that Yii displays on the page?

Page not found

I think there’s an some difficult in server configuration but I have no Idea which one :S

because i have tried also with a new site and srbac don’t want work, the strange think is that anything work nice

Set Yii to debug mode and check all the error trace

It’s already in debug mode :’(

Stack trace:

#0 /var/www/yii-1.1rc.r1585/framework/web/CWebApplication.php(120): CWebApplication->runController(‘srbac’)

#1 /var/www/yii-1.1rc.r1585/framework/base/CApplication.php(135): CWebApplication->processRequest()

#2 /var/www/provasrbac/index.php(11): CApplication->run()

#3 {main} REQUEST_URI=/provasrbac/index.php?r=srbac

P.S. thanks for your help and your time.

Sorry for trouble I found the problem :P

1.there are exist two task, admining and viewing. they are very nice. but now, i want to add other task. i see the action ‘actionCreate’ in AuthitemController, that mean we can create authitem, but on the srbac gui, i can’t find where i create role and task.

  1. if we can create my own task and role, so how can get the operations of customer task.

now, the srbac’s task based on controller, it’s easy scan the action, but our customer task?

  1. the “always allowed list” seem to some problem, if i selected some list, but next time they are don’t selected.

thanks your reply?

i’m sorry my poor english…

Hi,

1.Click on the first icon (Manage Auth item) and the autItem creation panel will appear.There you can add custom tasks/roles/operations (Click on create icon)

2.You have to create the operations manually, or auto create them and assign them to the task you created.But then you will have to manually create the checkAccess code in your controller’s actions

3.Which version of srbac do you use? Is the srbac/components/allowed.php file writable?

i use 1.1-rc.

the last question due to setting ‘alwaysAllowed’ property to array; solved.

i have see. it is a image with white color. i’m so careless; solved.

thanks.

hello, Spyros.

i’ve managed to solve my provlems.

the point was in naming DB tables - my MySQL tables where in lowercase, and i had ShiftedNames in config file.

You know, it still says that i have errors in configuration




<tr>

<td valign="top">layout</td>

<td>

<div class="installError"/>

<div class="installError"/>

</td>

</tr>




here is my config file




<?php


// 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'=>'App',


	// preloading 'log' component

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


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

        'application.controllers.*',

		'application.extensions.*',

		'application.modules.srbac.controllers.SBaseController',

	),

	//application modules

   'modules'=>array('srbac'=>

      array(

         // Your application's user class (default: User)

         "userclass"=>"user",

        // Your users' table user_id column (default: userid)

         "userid"=>"id",

        // your users' table username column (default: username)

         "username"=>"name",

        // If in debug mode (default: false)


         "debug"=>true,

       )

    ),


	// application components

	'components'=>array(

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'levels'=>'error, warning',

				),

			),

		),

		'authManager' => array(

       		'class'  => 'CDbAuthManager',

       		'connectionID'     => 'db',

       		'itemTable'          => 'authitem',

       		'itemChildTable'    => 'authitemchild',

       		'assignmentTable' => 'authassignment',

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

         ),


		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

		// uncomment the following to set up database

		'db'=>array(

		    'class'=>'CDbConnection',

			'connectionString'=>'mysql:host=localhost;dbname=localspecific',

			'username'=>'app',

            'password'=>'xxx',

		),


	),


	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']

	'params'=>array(

		// this is used in contact page

		'adminEmail'=>'webmaster@example.com',

	    

	),

);






i even passed by the installation process

so, i moved on to the ?r=srbac/authitem/manage -> AutoCreate AuthItems -> Scaning for AuthItems and it says that i need some function - getControllerPath()




Fatal error: Call to a member function getControllerPath() on a non-object in C:\wrk\localspecific\src\protected\modules\srbac\controllers\AuthitemController.php on line 696



  1. What’s the error in the configuration? I can’t understand it.

2.Which controller did you scan when the error occured?Is it in a module or in a controllers’ subdirectory?