An idea for Role Based Access Control

How works FF after you opened all the dialogs from a Roles page with the permission tree? Mine is dieing. Same on yours? cos I want to investigate.

Paul

well yes this job is realy good.

about usability I think have an issue that many people is not undertandings, the navigation is a litle confuse…

that I think have an bug at tree levels that not corresponding with the vertical aligment grouped by modules, controllers under module, actions under controller, permissions under actions; I have made a litle the file view.php:



<?php


function JQueryCheckTreeRender($items)


{


    foreach($items as $item){


        echo '<ul class="jqchecktree"><li>';


        if(isset($item['name'])){


            echo CHtml::checkBox($item['name'], $item['checked'], array('value'=>$item['value']));


        } else {


            echo CHtml::checkBox('', false);


        }


        echo CHtml::label($item['label'], '');


        if(array_key_exists('subs', $item) && is_array($item['subs'])){


            echo "n".'<ul>';


            JQueryCheckTreeRenderx($item['subs']);


            echo '</ul>';


        }


        echo '</li></ul>'."n";


    }


}





function JQueryCheckTreeRenderx($items)


{


    foreach($items as $item){


        echo '<li>';


        if(isset($item['name'])){


            echo CHtml::checkBox($item['name'], $item['checked'], array('value'=>$item['value']));


        } else {


            echo CHtml::checkBox('', false);


        }


        echo CHtml::label($item['label'], '');


        if(array_key_exists('subs', $item) && is_array($item['subs'])){


            echo "n".'<ul>';


            JQueryCheckTreeRenderx($item['subs']);


            echo '</ul>';


        }


        echo '</li>'."n";


    }


}





?>








    <?php JQueryCheckTreeRender($items); ?>








that currently having separate all modules and the aplication level under each vertical aligmnet, you can try find a solution to align the controllers, actions, etc…

regards

Max

maby this can help us!

http://floatmargin.c…eckboxtree.html

Missing argument 1 for RbacModule::init(), called in G:\home\yii1.0.4.r920\framework\base\CModule.php on line 78 and defined

Is this code base still maintained

Is any one maintaining the module piece of it?

The extension does not include the module :( 

For the problem with "Missing argument 1" u have 2 choices but i recommend:

1)change the CModule class and add the argument with default null - not recommended

  1. in RbacModule.php at line 25 take out the init argument - recommended

Yes, it's silence here for some time and the application contains the module, just make the previous change.

Good luck,

Paul

Quote

Missing argument 1 for RbacModule::init(), called in G:\home\yii1.0.4.r920\framework\base\CModule.php on line 78 and defined

Is this code base still maintained

I solve this problem by add this function to

RbacModule.php

   public function configure($config)

    {

        parent::init($config);

    }

and delete $config from init().

I think in earlier versions of framework all works fine.


Quote

Found the problem with the tree (I forgot to say that I'm using windows for development)

the problem is DIRECTORY_SEPARATOR

if we use

‘/’
instead will be better for everybody. It’s better for portability, anyway.

Paul

I have Firefox with firebug, it show me an error and what files wasn't find in "Net" tab. So I rapidly find where is problem.


Now ur turn to help me =)

I download

http://luckyteam.co…mp/rbactest.zip

and there is exception in

http://yii/rbactest/…users/myprofile

"Property "User.login" is not defined."

In this function relations are setted, but it does not work, as I think.

public function relations()

{


	return array(

            'login' => array(self::BELONGS_TO, 'RbacLogin', 'logins_id', 'alias'=>'login'),

            'globalGroup' => array(self::BELONGS_TO, 'GlobalGroup', 'global_groups_id', 'alias'=>'globalGroup'),

            'avatar' => array(self::BELONGS_TO, 'File', 'avatar_files_id'),

	);


}</span>

I just add login property to model class, and add get and set functions.

Also, I've put in CSS for tree view all from 20px at 19px.

An answer for your problem you'll find here:

http://www.yiiframew…3.html#msg11713 on EDIT 2

Somewhere in MyProfile if the current user doesn't have an associated profile it makes a new User and tries to set the login info of the current user. In 1.0.5 the direct access to related objects through "set" doesn't work. You have to use addRelatedRecord.

Paul

Hi,

I have another problem and I tryed to simplify it at max.

I have a view:

<?php $jui=$this->createWidget('application.extensions.JQueryUI.JQueryUI', array('theme'=>'base')); ?>


<div class="yiiForm">


<?php echo $jui->dialogForm(); ?>


<table>


  <tr>


    <th>Id</th>


	<th>Actions</th>


  </tr>


  <?php for($i=1; $i < 10; $i++): ?>


  	<tr>


  		<td><?php echo $i;?></td>


  		<td><?php echo CHtml::submitButton('SB',array('submit'=>'', 'params'=>array('idpc'=>$i))); ?>


  		</td>


  	</tr>


  <?php endfor; ?>


</table>


<?php echo CHtml::endForm(); ?>


</div><!-- yiiForm -->

The function in the controller is ismple:

if(Yii::app()->request->isAjaxRequest){


			$output = $this->renderPartial('test', array(), true, false);


			Yii::app()->getClientScript()->renderBodyEnd($output);


	        echo $output;


		}

The prblem is that when I'm clicking from the 5th button the dialog doesn't reload anymore and the whole page goes to the page needed to be rendered in the dialog box.

If I'm using dialogSubmitButton instead submitButton everything works, but in both cases the parameter set in params is not sent back to server.

Any idea?

THX

Paul

I think I have to take more time before I write here a question.

The problem is that the submitButton is made for a normal form, and the jQuery.yii.js is especially made for the Yii form.

The dialogSubmitButton doesn't set any param to the current form.

Changes, changes in JQueryUI.php

(first the button looks like this:

<?php echo $jui->dialogSubmitButton('SB', '',array('params'=>array('idpc'=>$i))); ?>

)

In registerClientScript I added

$cs->registerScript('addFormParams', 


        	'function addFormParam(f, p){ $.each(p, function(n, v) {var i = document.createElement("input");'.


			'i.setAttribute("type", "hidden");i.setAttribute("name", n);i.setAttribute("value", v);'.


			'f[0].appendChild(i);});}');

Inspired by the JS mentioned before.

In dialogSubmitButton I added/changed:

if(isset($htmlOptions['params']))


        {


        	$params=CJavaScript::encode($htmlOptions['params']);


			unset($htmlOptions['params']);


        }


        if(isset($params))


        {


        	$htmlOptions['onclick'] = 'f = $(this).parents("form");';


	        $htmlOptions['onclick'] .= 'addFormParam(f, '.$params.');';


        }


        if(!empty($url)){


        	if(!isset($params))


            	$htmlOptions['onclick'] = 'f = $(this).parents("form");';


            $htmlOptions['onclick'] .= 'f.attr("action", "'.CJavaScript::quote(CHtml::normalizeUrl($url), true).'");';


        }

Hope somebody need it ;)

Paul

Hello guys!

I have a (maybe) dumb questions:

  1. can this module be used to set permissions on object hierarchies ?

  like user|group edit sub-project from project -> sub-project -> sub-sub-project ?

  1. Can the permissions be inherited ? like is user|group has access to sub-project, it also has access to sub=sub-project ?

Thank you,

Serban

Hi,

Not tested and I think not direct/obvious support of this kind of features.

I think you can use bizrules for that.

I needed a different approach: users can access it's items or group/supergroup items and for that I created a template for bizrules like this:

"functionName#param1,param2,param3"

where the functionName is a php function implemented inside the RBAC class (in fact in an extension of it) and has designated params.

You have to implement also the bizrule parsing.

In that/those function you can implement the validation.

Paul

hello,

I am totally new to Yii and to this RBAC Alternative. I really like it so far. I have a quick question, though. When a specific user is denied from a certain Controller/Action access, he/she will get a 401 Error. Is there a way to customize that message (I'm pretty sure there is, but how?)

Can I catch this 401 before it hits the screen? (if it's an Exception or something). I also, put this filter in every controller I want access limitation on … right!?

    public function filters()


    {


        return array(


          array(


                'application.filters.RbacFilter',


              ),


        );


    }

thanks for the help,

–iM

I found a small bug on RbacCommand…

when i try to run rbac missing permission i’m getting the message:

Fatal error: Call to a member function filters() on a non-object in D:\workspace\esm\protected\comma

nds\shell\RbacCommand.php on line 361

to fix this change after (line 358)

$ci = Yii::app()->createController($c['id']);

put this…

if(is_array($ci)) $ci = $ci[0];

Bye…!

bumped up for

oleksiy

Error :

When I type the command "RBAC" the following error appears :

"[i]Yii Interactive Tool v1.0 (based on Yii v1.1-dev)

Please type ‘help’ for help. Type ‘exit’ to quit.

>> rbac help

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 439

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 439

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 439

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 439

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 516

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 516

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 516

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 516

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 800

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 800

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 800

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 800

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 802

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 802

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 802

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 802

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 856

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 856

PHP Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\

yii\cms\protected\commands\shell\RbacCommand.php on line 856

Deprecated: Call-time pass-by-reference has been deprecated in E:\wamp\www\yii\c

ms\protected\commands\shell\RbacCommand.php on line 856[/i] "

NOTE : I use Yii 1.1-dev, PHP 5.3.0.

Who can help me fix this bug? Thanks.

I get the following error:

Filter "application.filters.RbacFilter" is invalid. Controller "InstructorController" does have the filter method "filterapplication.filters.RbacFilter".

CException

Description

O filtro "application.ext.filters.RbacFilter" é inválido. O Controle "ClienteController" não possui o método de filtro "filterapplication.ext.filters.RbacFilter".

Does someone has the link posted in this thread, here:

http://www.yiiframework.com/forum/index.php?/topic/879-an-idea-for-role-based-access-control/page__st__20

I mean msg #36. I’m looking for that but in new forum links don’t work… :(

This is a great Extension!

Thanks