Yii Framework Forum: An idea for Role Based Access Control - Yii Framework Forum

Jump to content

  • (5 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • 5
  • You cannot start a new topic
  • This topic is locked

An idea for Role Based Access Control Rate Topic: -----

#61 User is offline   Paul Apostol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 25-March 09

Posted 14 April 2009 - 04:52 PM

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
0

#62 User is offline   megabr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 23-March 09
  • Location:Brazil

Posted 16 April 2009 - 11:39 AM

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

Attached File(s)


0

#63 User is offline   megabr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 142
  • Joined: 23-March 09
  • Location:Brazil

Posted 16 April 2009 - 11:58 AM

maby this can help us!
http://floatmargin.c...eckboxtree.html

0

#64 User is offline   Deepak Pradhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 209
  • Joined: 01-May 09
  • Location:Charlotte, NC

Posted 07 May 2009 - 05:38 PM

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
0

#65 User is offline   Deepak Pradhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 209
  • Joined: 01-May 09
  • Location:Charlotte, NC

Posted 19 May 2009 - 04:19 PM

Is any one maintaining the module piece of it?

The extension does not include the module :( 
0

#66 User is offline   Paul Apostol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 25-March 09

Posted 20 May 2009 - 12:29 AM

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
2) 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
0

#67 User is offline   msfs11 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 13-May 09

Posted 20 May 2009 - 06:46 AM

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


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

#68 User is offline   Paul Apostol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 25-March 09

Posted 20 May 2009 - 10:20 AM

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
0

#69 User is offline   Paul Apostol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 25-March 09

Posted 21 May 2009 - 01:40 PM

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
0

#70 User is offline   Paul Apostol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 25-March 09

Posted 21 May 2009 - 03:35 PM

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

0

#71 User is offline   serbanc 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 11-June 09

Posted 12 June 2009 - 04:24 AM

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 ?
2. 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
0

#72 User is offline   Paul Apostol 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 25-March 09

Posted 12 June 2009 - 06:28 AM

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
0

#73 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 706
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 13 June 2009 - 07:37 PM

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
0

#74 User is offline   William Lepinski 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 19-January 09
  • Location:São Paulo - Brazil

Posted 20 June 2009 - 11:01 AM

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...!


0

#75 User is offline   Deepak Pradhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 209
  • Joined: 01-May 09
  • Location:Charlotte, NC

Posted 04 July 2009 - 02:52 PM

bumped up for
oleksiy
0

#76 User is offline   tuyen.nv211 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 23-July 09

Posted 05 August 2009 - 10:30 AM

Error :

When I type the command "RBAC" the following error appears :
"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
"

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

Who can help me fix this bug? Thanks.
0

#77 User is offline   catman 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 18-August 09

Posted 17 September 2009 - 06:49 PM

I get the following error:

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

#78 User is offline   catataw 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 22-March 09

Posted 29 September 2009 - 09:02 AM

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

#79 User is offline   zitter 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 140
  • Joined: 14-July 09

Posted 04 October 2009 - 02:58 PM

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

http://www.yiiframew...ol/page__st__20

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

#80 User is offline   fibler 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 06-October 09

Posted 08 October 2009 - 03:43 PM

This is a great Extension!


Thanks
0

Share this topic:


  • (5 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • 5
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users