need help installing srbac???

Hi there, I’m new to Yii and im currently trying to install the srbac_1_02 module.

When I point my browser to webroot/index.php?r=srbac/authItem/install, i get the following error


CDbException

Description


CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1 no such table: items

Source File


/Applications/XAMPP/xamppfiles/htdocs/yii/framework/db/CDbCommand.php(118)

I’m not sure if there’s something i’ve missed or need to configure. I’m gathering that’s it’s looking for the 3 tables specified in the authManager array.

Also, when I remove the authManager array from main.php config file, I am able to view the install page. But can’t install.

Any help would be great!

thanks

could you show me your config here?

it should contain modules and authmanager.

here is mine:


'modules' => array(

		'srbac'=>

		  array(

		  "userclass"=>"User",

		  "userid"=>"id",

		  "username"=>"username",

		  "debug"=>true,

		  "pageSize"=>10,

		  "superUser" =>"Authority",

		  "css"=>"css/srbac.css",

		  )

	),


'components'=>array(

		// auth manager

		'authManager'=>array(

		  'class'=>'CDbAuthManager',

		  'connectionID'=>'db',

		  'itemTable'=>'items',

		  'assignmentTable'=>'assignments',

		  'itemChildTable'=>'itemchildren',

		 ),

// ... another components

)



Sure thing!


return array(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'My Web Application',


	// preloading 'log' component

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


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

	),


	// application components

	'components'=>array(

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'levels'=>'error, warning',

				),

			),

		),

		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

		// uncomment the following to set up database

		'db'=>array(

			'connectionString'=>'sqlite:'.dirname(__FILE__).'/../data/data.db',

		),

		'authManager'=>array(

		  // The type of Manager (Database)

		  'class'=>'CDbAuthManager',

		  // The database connection used

		  'connectionID'=>'db',

		  // The itemTable name (default:authitem)

		  'itemTable'=>'items',

		  // The assignmentTable name (default:authassignment)

		  'assignmentTable'=>'assignments',

		  // The itemChildTable name (default:authitemchild)

		  'itemChildTable'=>'itemchildren',

		 ),

	),

	

	// application modules	

	'modules'=>array(

		'srbac'=>

		  array(

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

		  "userclass"=>"User",

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

		  "userid"=>"user_ID",

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

		  "username"=>"username",

		  // If in debug mode (default: false)

		  // In debug mode every user (even guest) can admin srbac, also 

		  //if you use internationalization untranslated words/phrases 

		  //will be marked with a red star

		  "debug"=>true,

		  // The number of items shown in each page (default:15)

		  "pageSize"=>10,

		  // The name of the super user

		  "superUser" =>"Authority",

		  //The css file to use

		  "css"=>"srbac_red.css", // must be in srbac css folder

		  //The layout to use

		  "layout"=>"admin", // must be in protected/views/layouts/

		  //The not authorized page

		  "notAuthorizedView"=>"application.views.site.unauthorized",

		  )

	),


	// 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 haven’t dived into yii extensively yet. I did browse the docs on authManager but it doesn’t seem to require anymore configuration. Hmmm… not sure? And the base app seems to work fine when i visit it.

Is your sqlite database in the path described in

‘connectionString’=>‘sqlite:’.dirname(FILE).’/../data/data.db’ ?

Also download again version 1.02 of srbac because a bug is fixed that may prevent you from installing and using srbac

I tried the previous version and it seemed to work fine. Just not with the latest release.

There’s a bug in AuthItamController.php

change the




 protected function beforeAction($action) {

        if( Yii::app()->user->checkAccess(Helper::findModule('srbac')->superUser) ||

            !Helper::isAuthorizer()) {

            return true;

        } else {

            parent::beforeAction($action);

        }


    }



with this one




 protected function beforeAction($action) {

        if($this->module->debug){

          return true;

        }


        if( Yii::app()->user->checkAccess(Helper::findModule('srbac')->superUser) ||

            !Helper::isAuthorizer()) {

            return true;

        } else {

            parent::beforeAction($action);

        }


    }



I will update the zip file too