[MODULE] alternate-rbac-ui

The module incorporates an ideas from the alternaterbac and srbac. For example, you can try this with the Yii Framework 1.1 blog demo. Below is an example of blog configuration.

In the main blog configuration:




return array(

	...

	'components'=>array(

		...

		'authManager'=>array(

			'class'=>'rbac.components.RbacAuthManager',

		),

		...

	),

	...

	'modules'=>array(

		'rbac'=>array(

			'layoutPath'=>'protected/views/layouts',

		)

	),

	...

);



In the blog controllers:




public function filters()

{

	return array(

		array('rbac.components.RbacAccessControl')

	);

}



Then point your browser to:


http://your-blog/index.php/rbac/default/install - Module Installation


http://your-blog/index.php/rbac/default/admin - Manage Authentication Items


http://your-blog/index.php/rbac/default/assign - Assign Authentication Items


http://your-blog/index.php/rbac/default/assignments - User Assignments

This topic is for your feedback. Thanks.

getting error CException "Role._pk" is not defined

when installing rbac on blog app and pressing "create detected permissions" button

the same error occurs when trying to access ."…/demos/blog/index.php/rbac/default/admin"

Fixed:




--- rbac_old/components/RbacDataProvider.php	2010-02-12 08:43:49.000000000 -0600

+++ rbac_new/components/RbacDataProvider.php	2010-02-15 21:35:23.000000000 -0600

@@ -242,19 +242,9 @@

 	public function populateRecord($attributes)

 	{

 		if ($attributes !== false) {

-			$record = $this->instantiate($attributes);

-			$record->setScenario('insert');

-			$md = $record->getMetaData();

-			foreach ($attributes as $name => $value) {

-				if (property_exists($record, $name)) {

-					$record->$name = $value;

-				} else if (isset($md->columns[$name])) {

-					$record->setAttribute($name, $value);

-				}

-			}

-			$record->_pk = $record->getPrimaryKey();

-			$record->attachBehaviors($record->behaviors());

-			return $record;

+			$class = $attributes[$this->className];

+			$record = CActiveRecord::model($class);

+			return $record->populateRecord($attributes, false);

 		} else {

 			return null;

 		}



Thanks.

Could you submit your project to Google Code (for SVN access and possible collaboration) and/or Yii extension repository to find it there?

I’m gonna test it, Sounds good.

Regards.

Sure. The module is saved as google project and can be accessed through http://code.google.com/p/alternate-rbac-ui (Please test if you are allowed to commit).

Also can I ask, how can I add the module to Yii repository?

Regards.

Go to http://www.yiiframework.com/extensions/ and log in with your forum account, then click on Create new extension.

Hello,

I’m facing the same problem with all the filters that I define by myself, even with this module.

I’m getting this error:

[b]Filter "application.modules.rbac.components.RbacAccessControl" is invalid. Controller "PostController" does have the filter method "filterapplication.modules.rbac.components.RbacAccessControl".

[/b]

I’ hope that I’ll get a fast reply plz:S

Hello,

I’m getting the same error when rbac filter is defined as inline filter in the PostController:




public function filters()

{

	return array(

		'rbac.components.RbacAccessControl',

	);

}



Try this configuration:




public function filters()

{

	return array(

		// 'accessControl', // controller must have a method filterAccessControl, see yii.web.CController

		array('rbac.components.RbacAccessControl'),

	);

}



Or you can write wrapper of RbacAccessControl in your (base)controller:




public function filterRbac($filterChain)

{

        Yii::import('rbac.components.RbacAccessControl');

        $filter=new RbacAccessControl;

        $filter->filter($filterChain);

}



then you can define filter as:




public function filters()

{

        return array(

                'rbac',

        );

}



missing file User.php in model folder