Yii Framework Forum: need help installing srbac??? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

need help installing srbac??? Rate Topic: -----

#1 User is offline   fibler 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 06-October 09

Posted 06 October 2009 - 10:15 AM

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
0

#2 User is offline   Ahyo Haryanto 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 21-May 09
  • Location:Yogyakarta Indonesia

Posted 06 October 2009 - 04:31 PM

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
)

Open Source? Open Mind!
0

#3 User is offline   fibler 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 06-October 09

Posted 06 October 2009 - 04:54 PM

View Postpegel.linuxs, on 06 October 2009 - 04:31 PM, said:

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.
0

#4 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 06 October 2009 - 11:04 PM

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
0

#5 User is offline   fibler 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 06-October 09

Posted 07 October 2009 - 04:52 PM

View PostSpyros, on 06 October 2009 - 11:04 PM, said:

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.
0

#6 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 08 October 2009 - 12:16 AM

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users