Yii Framework Forum: [MODULE] alternate-rbac-ui - Yii Framework Forum

Jump to content

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

[MODULE] alternate-rbac-ui Role-Based Access Control module for Yii Framework 1.1 Rate Topic: ***** 1 Votes

#1 User is offline   xmaks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-September 09
  • Location:Czech Republic

Posted 12 February 2010 - 04:44 AM

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.

Attached File(s)


Linux From Scratch, Apache/2.2.9, PHP/5.2.6, Mysql/5.0.51, Sqlite/3.5.9, Yii/1.1.0
0

#2 User is offline   windigo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 16-January 10

Posted 14 February 2010 - 11:32 AM

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

#3 User is offline   xmaks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-September 09
  • Location:Czech Republic

Posted 15 February 2010 - 03:55 PM

View Postwindigo, on 14 February 2010 - 11:32 AM, said:

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.
Linux From Scratch, Apache/2.2.9, PHP/5.2.6, Mysql/5.0.51, Sqlite/3.5.9, Yii/1.1.0
0

#4 User is offline   robregonm 

  • Experienced Yii Developer
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 602
  • Joined: 30-July 09
  • Location:Colombia

Posted 15 February 2010 - 07:06 PM

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.
Ricardo Obregón
LinkedIn Profile
YiiFramework en Español - http://yiiframework.co/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx, MySQL, PostgreSQL, Yii 1.x & 2.x, CanJS and more.
Follow me: @robregonm & @obregonco & @1ServerCo.
0

#5 User is offline   xmaks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-September 09
  • Location:Czech Republic

Posted 17 February 2010 - 01:40 AM

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

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

Regards.
Linux From Scratch, Apache/2.2.9, PHP/5.2.6, Mysql/5.0.51, Sqlite/3.5.9, Yii/1.1.0
0

#6 User is offline   scythah 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 44
  • Joined: 20-April 09

Posted 17 February 2010 - 04:36 AM

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

#7 User is offline   Maro 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 19-January 10

Posted 22 February 2010 - 01:53 AM

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:

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


I' hope that I'll get a fast reply plz:S
0

#8 User is offline   xmaks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-September 09
  • Location:Czech Republic

Posted 22 February 2010 - 03:36 AM

View PostMaro, on 22 February 2010 - 01:53 AM, said:

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:

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


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'),
	);
}

Linux From Scratch, Apache/2.2.9, PHP/5.2.6, Mysql/5.0.51, Sqlite/3.5.9, Yii/1.1.0
0

#9 User is offline   xmaks 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-September 09
  • Location:Czech Republic

Posted 22 February 2010 - 03:52 AM

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',
        );
}

Linux From Scratch, Apache/2.2.9, PHP/5.2.6, Mysql/5.0.51, Sqlite/3.5.9, Yii/1.1.0
0

#10 User is offline   *kenny 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 22-August 10

Posted 22 August 2010 - 04:40 PM

missing file User.php in model folder
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