Yii Framework Forum: Bizrules And Accessrules Doubt - Yii Framework Forum

Jump to content

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

Bizrules And Accessrules Doubt bizrules and accessRules doubt Rate Topic: -----

#1 User is offline   ferminako 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 67
  • Joined: 27-February 13

Posted 06 April 2013 - 05:49 AM

Hi everyone,

I've generated this without bizrules:
$auth=Yii::app()->authManager;
		$auth->createOperation('editar','Es una op...');
		$task=$auth->createTask('tarea_edicion','Es una tare...');
		$task->addChild('editar_tipos');
		$role=$auth->createRole('rol_edicion_tipos','Este....');
		$role->addChild('tarea_edicion_tipos');
		$auth->assign('rol_edicion',$this->user->id);


And using this in the controller:

public function accessRules()
	{
		return array(
			array('allow',  // allow all users to perform 'index' and 'view' actions
				'actions'=>array('index','view','create','update','delete','admin'),
				'roles'=>array('rol_edicion'),
				//'expression'=>'Yii::app()->user->checkAccess("rol_edicion")',
			),


That works properly but I need bizrules... so I tried to use them, but it didn't work as I wanted.

So can I use bizrules via accessRules without using

if(Yii::app()->user->checkAccess(....
?

I mean , can I generate this new structure with bizrules:

$auth=Yii::app()->authManager;
		$auth->createOperation('editar_tipos','Es una op...');
		 $bizRule= "return 1 == 1";
		$task=$auth->createTask('tarea_edicion_tipos','Es una tare...');
		$task->addChild('editar_tipos');
		$role=$auth->createRole('rol_edicion_tipos','Este....',$bizRule);
		$role->addChild('tarea_edicion_tipos');
		$auth->assign('rol_edicion',$this->user->id);


And use it with the accessRules in the controller???

Because I tried it but it doesn't work, it's the same if I set

$bizRule= "return 1 == 0";

or
$bizRule= "return 1 == 1";


I can't access the controller as I could without bizrules...

Need some help please :D

Thanks!
0

#2 User is offline   ferminako 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 67
  • Joined: 27-February 13

Posted 07 April 2013 - 06:57 AM

need help please :-[
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