[EXTENSION] srbac : Web interface for the administration of rbac

Since many people suffer from the layout bug I released the new version a little bit earlier

Zip download and updated guide:

http://www.yiiframework.com/extension/srbac/#download

http://code.google.com/p/srbac/downloads/list

Enhancements

always allow acces when srbac is in debug mode.

Auth items are auto created only for controllers that extend SBaseController.

Bug Fixes

Fixed IE bug when tab selection was not allowed in assign page

Fixed bug when layout is set to ‘main’

Change the character that indentifies a module in authItems from _ to /

[color="#FF0000"]NOTE

When upgrading to Version 1.1.0.2 (r174) you should change in auth items the ‘_’ character that identifies the modules to ‘/’.[/color]

using pii

put line "layout"=>"application.views.layouts.main",

into file modules/pii/config/pii.php into array srbac (modules…pii…modules…srbac)

Dear Spyros,

I use yii-user with srbac based on SBaseController. Works well. I have a little issue:

in RegistrationController there is: public function actions(){…‘captcha’=>…}

how could I handle permisson of captcha or all things in actions method with SBaseController?

(in basic webapp SiteController has the same issue (actions() method) and site/contact uses captcha as well)

Regards,

sis

sorry, I’ve just seen http://code.google.com/p/srbac/issues/detail?id=44

(I am still working on it)

A quick fix (not tested ) to put the captcha action manually in the allowed.php file

A new version 1.1.0.3 is available

It’s actually a bug fix for a compatibility issue with Yii 1.1.1

In Yii 1.1.1 CHtml::clientChange uses a $live variable that defaults to true.

This caused multiple ajax submits when using the auto create authitems tool.

I couldn’t find a way to set $live to false so it’s fixed by extending CHtml and set $live to false.

sorry

Srbac doesn’t go well on IE7, tried to update role, but ListBox does not auto update.

Thanks

CoLT

So a while ago (page 24) I was having a problem where I couldn’t see the always allowed GUI. I fixed this by setting my config to ‘alwaysAllowed’=>‘gui’, and it worked fine. It suddenly stopped working again, and I have no idea why. Here’s my configuration info:


'srbac' => array(

                    'userclass'=>'user', //optional defaults to User

                    'userid'=>'user_oid', //optional defaults to userid

                    'username'=>'email', //optional defaults to username

                    'debug'=>true, //optional defaults to false

                    'pageSize'=>10, //optional defaults to 15

                    'superUser' =>'Authority', //optional defaults to Authorizer

                    'layout'=>'application.views.layouts.main', //optional defaults to empty string

                    // must be an existing alias

                    'alwaysAllowed'=>'gui',

                    'userActions'=>array(//optional defaults to empty array

                        'Show','View','List'

                     ),

                    'listBoxNumberOfLines' => 15, //optional defaults to 10 'imagesPath' => 'srbac.images',

                    //optional defaults to srbac.images 'imagesPack'=>'noia',

                    //optional defaults to noia 'iconText'=>true,

                    //optional defaults to false 'header'=>'srbac.views.authitem.header',

                    //optional defaults to srbac.views.authitem.header, must be an existing alias

                    //'footer'=>'srbac.views.authItem.footer', //optional defaults to

                    // srbac.views.authitem.footer, must be an existing alias 'showHeader'=>true, //optional defaults to false 'showFooter'=>true, //optional defaults to false

                    'alwaysAllowedPath'=>'srbac.components', //optional defaults to srbac.components

                    // must be an existing alias

            ),

Any ideas as to what’s going on? I updated to the latest version 1.1.0.3, and still have the same problem.

I used your configuration and had no problem. Is there an error in firebug?

I noticed that after clicking other roles it updates the ListBox :slight_smile: But after entering any srbac manu it is empty on IE;)

Regards,

CoLT

Yes in IE almost all ajax is not functioning. I couldn’t find why.

Yes… oddly enough, it was for another separate module that wasn’t properly configured (in config, I was trying to import it from the modules folder, but it wasn’t in the modules folder anymore). For some reason, that caused the one page in the SRBAC module to bug out, even though everything else was fine.

Not quite a bug, just a peculiar counter-intuitive behavior…

Hi Spyros,

I hope you might be able to help…

I have manage to get srbac working on various occasions…However…

After installing the new version on fresh yii skeleton with a user class. All instructions followed…

And the following config for module

            'srbac'=>array(


                'userclass'=>'user', // Your application's user class (default: User)


                'userid'=>'id',


                'username'=>'username',


                'debug'=>true, //optional defaults to false


                'pageSize'=>10, //optional defaults to 15


                'superUser' =>'admin', //optional defaults to Authorizer


                'css'=>'srbac.css', //optional defaults to srbac.css


                'layout'=>'application.views.layouts.main',


                'imagesPack'=>'noia',


                'alwaysAllowed'=>'gui',


                'userActions'=>array('Show','View','List'),


                'imagesPath' => 'srbac.images',


                'iconText'=>true,


                'header'=>'srbac.views.authitem.header',


                'footer'=>'srbac.views.authitem.footer',


                'notAuthorizedView'=>'srbac.views.authitem.unauthorized ',


            ),

I can get to the install page…But…I could Not get the install button to appear

It says There is an error in your configuration

Create demo authItems?

Do you have view ‘unauthorized’ ?


'notAuthorizedView'=>'srbac.views.authitem.unauthorized', 

Try


'notAuthorizedView'=>'srbac.views.authitem.error' 

;)

I tested out with fresh Yii and it works ;)

P.S. manual in http://spyros.agilityhoster.com/demos/index.php?r=site/srbacDoc should be definitely updated.

More or less with configuration file like this:

‘modules’ => array(

‘srbac’=>

array(


...


  "css"=>"srbac[s]_red[/s].css", // must be in srbac css folder


  //The layout to use


  "layout"=>"application.views.layouts.[s]admin[/s]main",


  //The not authorized page to render when a user tries to access an page


  //tha he's not authorized to


  "notAuthorizedView"=>"application.views.site.[s]unauthorized[/s]error",


...

),

),

Thanks

CoLT

Noticed layout problem in P2 and also with fresh Yii+srbac installed.

Thanks

CoLT

The latest documentation is always there

http://code.google.com/p/srbac/downloads/list

I have noticed the layout problem in alwaysAllowed GUI. It happens when there are not many controllers to show. It will be fixed

I have suggestion to create interface for controllers classes (and maybe modules) that would add for example getSrbacNames() method, which would return custom names for actions. For example:

Controller accounts in module users , could have something like that:




class Accounts extends CController

{

//...

public function getSrbacNames()

{

return array('name'=>'Users: Accounts.','actions'=>array('index'=>'ListUsers','login'=>'Login user'));

}

//..

}



It has two main benefits, more user friendly names can be created and it is possible to make multi-lingual names for actions in srbac.

I have problem with installation. Everything is green, when I press install i get message that installation is successful, but when I click go to front page I am redirected to installation page.

This means that srbac doesn’t find the auth tables in the database. Check the if the names of the tables are the same as entered in srbac config (case sensitive - lower case)

Thx every think works, I didn’t set names and srbac had camel notation for tabels, mysql created names in lowercase. Thx again :).

I have another question. I have login action and in controller accounts, which is in module Users. I wanted to assign this action to notAuthorizedView, but I get error. Is it possible to assign action instead of view only?