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

Srbac is a module that adds a graphic web interface for the administration of Yii rbac

It uses the  CDbAuthManager so it needs a database (MySQL and SQlite are tested)

In this first alpha version you can do:

Create, update and delete Auth items (roles, tasks, operations)

Assign operations to tasks, tasks to roles and roles to users.

You can't yet assign operations to users, tasks to operations etc.

Demo http://spyros.agilit…authItem/assign

Extension http://www.yiiframew…xtension/srbac/

http://spyros.agilit…authItem/assign

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 19 columns parent, child are not unique

/home/www/spyros.agilityhoster.com/yii/framework/db/CDbCommand.php(211)

// Your application's user class (default: User)

"userclass"=>"User",

How to configure this? Do I need to create a user class?

Quote

// Your application's user class (default: User)

"userclass"=>"User",

How to configure this? Do I need to create a user class?

Yes , you must have a user class if you want to use the extension

It's a very alpha version.

Dear creator, do u have a plan  for  next release?

I need  to know  create my own interface, modify SRbac extension or wait  some days for new version.

The releases depend on user's feedback.

If anyone finds bugs that need to be fixed, or has an idea to add, it will be implemented asap.

Is this release stable enough to become the version 1?

Do you want something to be added?

Thanks for your interest

Quote

Hello. I trying to use srbac. But, after configuration of authManager and srbac, my browser cannot retrieve url "index.php?r=srbac/authItem/install" with message "Page not found". What's the problem?

Have you added the srbac module in you config file



<?php


 'modules'=>array('srbac'=>


  array(


  // Your application's user class (default: User)


  "userclass"=>"User",


  // Your users' table user_id column (default: userid)


  "userid"=>"user_ID",


  // your users' table username column (default: username)


  "username"=>"username",


  // If in debug mode (default: false)


  "debug"=>true,


  // The number of items shown in each page (default:15)


  "pageSize"=>10,


  )


  ),


?>


[code]

After i navigate my browser to the "index.php?r=srbac/authItem/install" url, i recieve the error message "Undefined index: action" in the line



$action = $_POST['action'];


of the acionInstall() method of the AuthItemController class.

Can you help me to resolve this problem?

Quote

Quote

Hello. I trying to use srbac. But, after configuration of authManager and srbac, my browser cannot retrieve url "index.php?r=srbac/authItem/install" with message "Page not found". What's the problem?

Have you added the srbac module in you config file



<?php


 'modules'=>array('srbac'=>


  array(


  // Your application's user class (default: User)


  "userclass"=>"User",


  // Your users' table user_id column (default: userid)


  "userid"=>"user_ID",


  // your users' table username column (default: username)


  "username"=>"username",


  // If in debug mode (default: false)


  "debug"=>true,


  // The number of items shown in each page (default:15)


  "pageSize"=>10,


  )


  ),


?>


[code]

This problem reason was wrong directory of srbac. Browser really couldn’t find this path :)

Yes, i have added srbac in the main config file of the application to the 'modules' section.

probably you have

error_reporting  =  E_ALL

in your php ini

You may overide it by changing it to

error_reporting  =  E_ALL & ~E_NOTICE

or wait until I fix this issues (update should be up tonight)

Thanks for your fast reply.

Yes  i do all by instructions.

But i see massive of  warnings and errors when try open page assign page.

Also for install i do some changes  in the code for detemine variables, because install.php did not  know vars $error and $disabled. After installation i see test data on default page index.php?r=srbac/authItem/ , page  work normaly.

Then i try page index.php?r=srbac/authItem/assign and look on many errors  about Post['action'] and about var's based on it and other POST data.

For fix it i do next with AuthItemController:

add under line 84 

		$userid = &#039;&#039;;


		$active = &quot;tab1&quot;;


		$message = &quot;&quot;;

add after block //Init values finished:

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

			$userid = $_POST[Yii::app()-&gt;getModule(&#039;srbac&#039;)-&gt;userclass][$this-&gt;module-&gt;userid];


		}

After this  actions page /index.php?r=srbac/authItem/assign work and  show  me tab's.

On trying  use the buttons '>>>' and '<<<', on any tab,  i catch the Fatal error:

Undefined index: User    AuthItemController.php(105)

After  this i write  the  my first today msg. in this  thread  and  back to real application.

Now i go to home  and do test this ext. on full clean yii 1.07 w/o something

If it will work fine i will search the bug.

I hope  on Your help Spyros.

This ext. is very usefull, if  u need help i'm ready for action. Anywhere  i will construct interface for manage  RBAC. may be  based  on this ext, may be not.

Wait Your reply.

The extensions was developed with

error_reporting  =  E_ALL & ~E_NOTICE

in the php.ini (my fault) so I saw no errors while developing

I will fix the errors in the next release

This is a very quick fix for the warnings.

Use this and tell me if there are still any problems

Thank for fix.

Quick fix work fine. @.

I do  some  tests for    assign and  deassign users, roles and  tasks.

and found some interface bugs.

I did next:

First

When open the ?r=srbac/authItem/assign i see all assigned items in the Assigned control (middle select on each tab)

Second

Does not see caution message  when press the <<< or >>>

when wrong selection.

Third

-select role or task tab

-select item in Assigned control

-press <<< or >>>

interface move  to users tab

Thanks, I'll fix those too in the update

Today i fill the RBAC mdodel over You ext. with quick fix.

I think  extension  need  the tabled input methods or import methods for write  many AuthItems. Also  a model in CVS files look more readiable.

For very far future: very nice will add a graphical interface  :slight_smile:

Found a bug.

  • open srbac/authItem/admin

  • click Update action on  any AuthItem from list

  • Change Name field

  • Save

----- Catch a error message 'The requested page does not exist.'

This is because the name is the primary key so you should not change it.

I 'll look if there's a way to safely change the name of any item

I think need update base tables with fields type INT4  with AUTO_INCREMET,

in my case  SERIAL (I'm use Postgres).

And setup interface for use  its fields