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

You just need a User table. The auth tables are created during installation

Spyros:

Here’s the solution to Issue 48 in the issue tracker:

IE 7/8 on XP dislike trailing commas in javascript, so, at line 88-90 in operationToTask view, change:


  success: function(data){

     $('#operations').html(data);

   },

to:


  success: function(data){

     $('#operations').html(data);

   }

Also, I posted fixes to postgres compatibility issues, can you let me know whether these can be added to the next release so I don’t have to customize?

Thanks,

Yes I will add your correction in srbac 1.1.1 version

I was extracted srbac extention in my ‘modules’ yii aplication.

So the directory now like this

/webapp/protected/modules/srbac/

and I was configurated


'import'=>array(

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

),

in ‘/webapp/protected/config/main.php’

but when I browsed /path/to/application/index.php?r=srbac, error show up Unable to resolve the request "srbac".

I don’t know how to fix it. Thanks for help.

Hi,

you need to add srbac with the configuration to the modules field inside your yii config like this




'modules' => array(

    'srbac' => array(

        ...configuration

    ),

)



you can find an example for the configuration in the docu

Thanks you Slavic, but now I’m get new problem. I can’t unset read only for any file and folder under modules directory, so error [color="#FF0000"]Property “CWebApplication.authManager” is read only[/color] appear. but I think it’s OOT.

Hi,

Did you setup the configuration like in the Doku?

You need this parts (MySql):




'db'=>array(

    'class'=>'CDbConnection',

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

    'username'=>'yourUsername',

    'password'=>'yourPassword',

),


'authManager'=>array(

    'class'=>'CDbAuthManager',

    'connectionID'=>'db',

    'itemTable'=>'items',

    'assignmentTable'=>'assignments',

    'itemChildTable'=>'itemchildren',

),


'modules' => array(

    'srbac' => array(

        'userclass' => 'User', //your user model class

        'userid' => 'user_ID', //field of the user id

        'username' => 'username', //field name of the username

        'debug' => true,

        'pageSize' => 10,

        'superUser' => 'Admin',

        'css' => 'srbac.css',

        'layout' => 'application.views.layouts.admin',

        'notAuthorizedView' => 'srbac.views.authitem.unauthorized ',

        'alwaysAllowed' => 'gui',

        'userActions' => array(

            'Show','View','List'

        ),

        'listBoxNumberOfLines' => 15,

        'imagesPath' => 'srbac.images', 

        'imagesPack' => 'noia',

        'iconText' => true,

        'header' => 'srbac.views.authitem.header',

        'footer' => 'srbac.views.authItem.footer',

        'showHeader' => true,

        'showFooter' => true,

        'alwaysAllowedPath' => 'srbac.components',

    )

),


'import'=>array(

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

),



I copy-pasted your codes above and back to [color="#FF0000"]Unable to resolve the request "srbac"[/color] error.

Log record:




2010/03/11 16:13:13 [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Unable to resolve the request "srbac".' in C:\www\yii11\framework\web\CWebApplication.php:324

Stack trace:

#0 C:\www\yii11\framework\web\CWebApplication.php(120): CWebApplication->runController('srbac')

#1 C:\www\yii11\framework\base\CApplication.php(135): CWebApplication->processRequest()

#2 C:\www\backend\index.php(11): CApplication->run()

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



can you post your compleat configuration please. maybe I can find where the error is.

Here it is:




<?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'=>'Content Administrator',


	// preloading 'log' component

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


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

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

	),


	// application components

	'components'=>array(

		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

		/*'db'=>array(

			'connectionString' => 'sqlite:protected/data/testdrive.db',

		),*/

		// uncomment the following to use a MySQL database

		'db'=>array(

    'class'=>'CDbConnection',

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

    'username'=>'root',

    'password'=>'xxxxxx',

),


'authManager'=>array(

    'class'=>'CDbAuthManager',

    'connectionID'=>'db',

    'itemTable'=>'items',

    'assignmentTable'=>'assignments',

    'itemChildTable'=>'itemchildren',

),


'modules' => array(

    'srbac' => array(

        'userclass' => 'User', //your user model class

        'userid' => 'user_ID', //field of the user id

        'username' => 'username', //field name of the username

        'debug' => true,

        'pageSize' => 10,

        'superUser' => 'Admin',

        'css' => 'srbac.css',

        'layout' => 'application.views.layouts.admin',

        'notAuthorizedView' => 'srbac.views.authitem.unauthorized ',

        'alwaysAllowed' => 'gui',

        'userActions' => array(

            'Show','View','List'

        ),

        'listBoxNumberOfLines' => 15,

        'imagesPath' => 'srbac.images', 

        'imagesPack' => 'noia',

        'iconText' => true,

        'header' => 'srbac.views.authitem.header',

        'footer' => 'srbac.views.authItem.footer',

        'showHeader' => true,

        'showFooter' => true,

        'alwaysAllowedPath' => 'srbac.components',

    )

),

		

		'errorHandler'=>array(

			// use 'site/error' action to display errors

            'errorAction'=>'site/error',

        ),

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'levels'=>'error, warning',

				),

				// uncomment the following to show log messages on web pages

				/*

				array(

					'class'=>'CWebLogRoute',

				),

				*/

			),

		),

	),


	// application-level parameters that can be accessed

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

	'params'=>array(

		// this is used in contact page

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

	),

);



Does this view really exist ?

‘application.views.layouts.admin’

No, It doesn’t. But, when I change to existing view layout (‘application.views.layouts.main’), the ‘srbac’ request still unable resolve. I also tried to add comment slash in ‘layout’ line, but nothing happen.

Dear Spyros,

First of all thank you for this great plugin!

Automatically create operations/tasks and automatically check for access,

it is greeeat!

I have a little issue.

I use SBaseController in the yii_1.1.0/demos/blog/protected/*.php except in the SiteController.php.

Everything works fine.

If I want to extend SBaseController in SiteController.php I have to put a line:

public $breadcrumbs;

into yii_1.1.0/demos/blog/protected/modules/srbac/controllers/SBaseController.php

otherwise I get some errors in the front page with some breadcrumb thing.

Do you use SBaseController in SiteController or this is a bad idea?

Thank you!

sis

yes, public $breadcrumbs should be added in SBaseController

It’s already added in srbac 1.1.0.1 version

Which version do you use?

I use srbac 1.1.0.1_r165.zip, I found public $breadcrumbs only in AuthitemController.php.

(I’ve seen that AuthitemController extends SBaseController.)

Only SiteController needs breadcrumbs in SBaseController.

PostController, CommentController, UserController all work fine without breadcrumbs in SBaseController.

(Off: links in posts does not work in the forum, eg.: first post in this topic)

Hi guys,

I wanted to try srbac for my app, as I really like the idea of having a gui for configuring all the authorization stuff. But i’ve got a little problem with the installation. It tells me that there is an error in my configuration but i don’t know where. Especially as all the dots in the status table are green (see attachment). The second attachment contains my srbac configuration.

Any ideas what I did wrong?

Cheers

Try uncomment layout…and use like this…

‘layout’=> ‘application.views.layouts.main’,

Thank you seal, that actually got it to work :)

Have some troubles installing with Yii 1.1.0 and 1.1.1 on WinXP+WAMP

Has anyone tried so?

Also not working on integrated SRBAC with Pii (module)

Only hidden Install button is seen and message:

There is an error in your configuration

Any solutions? Thanks!

Check the latest code from

http://code.google.com/p/srbac/source/checkout

Also make sure that layout attribute points to an existing file

(use ‘layout’=> ‘application.views.layouts.main’ for example)