Yii 1.1: alternaterbac

An alternate Role Based Access Control
2 followers

This extension is an alternate role based access control system for the Yii. It meant to be more tied to the MVC in that sense that each permission is closely related to controller/action pair and access checking is being performed in controller filters.

It also features an yiic shell command which will allow you to fully manipulate permissions and roles, e.g. create/update/grant and revoke, search, etc.

At present this extension is in early stage and was only tested with MySQL 5 database

There is a small description available here: http://www.yiiframework.com/forum/index.php/topic,905.0.html

All comments, bug reports and suggestions are welcome.

Resources

Documentation

Requirements

  • Yii 1.0 or above
  • MySQL 5.0 or above

Installation

  • put Rbac.php to /protected/components
  • put RbacFilter.php to /protected/filters
  • put RbacCommand.php to /protected/commands/shell
  • Configure 'rbac' component
php
'components'=>array(
        'rbac' => array(
            'class'=>'application.components.Rbac',
        ),
.......
  • import rbac.sql into your empty test(!) database
  • add some users to the database manually
  • tell your controllers to use RbacFilter:
php
public function filters()
{
   return array(
     array(
            'application.filters.RbacFilter',
          ),
   );
}
  • start adding roles and permissions with the rbac shell command, e.g. run ./protected/yiic shell to enter running shell and then issue rbac command to get its help.

Change Log

February 25, 2009

  • Initial release.

February 28, 2009

  • version 1.1
  • AccessControlFilter renamed to RbacFilter (file and the class, don't forget to update filters() method)
  • Added application component Rbac
  • requires Yii v1.0.3
  • rbac component implements two methods for access validation

Total 4 comments

#831 report it
Maro at 2010/02/22 02:32am
Filter problem

I'm getting this error:

Filter is invalid. Controller "PostController" does have the filter method...

I' hope that I'll get a fast reply plz:S

#1704 report it
henqi at 2009/05/03 04:20am
Pass by ref deprecated?

Yii Interactive Tool v1.0 (based on Yii v1.0.4) Please type 'help' for help. Type 'exit' to quit.

Rbac Php Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of runtime function name. If you would like to enable call-time pass-by-refere nce, you can set allow_call_time_pass_reference to true in your INI file. Howev er, future versions may not support this any longer. in /www/testyii3/protected /commands/shell/RbacCommand.php on line 439

: :

Can anybody advice on this warning?

#1758 report it
bayonian at 2009/04/15 06:08am
Nice Extension

Yes, I second that. It should allow developer to name their own tables.

Good job.

#1810 report it
investor at 2009/03/27 01:29pm
Good work!

I think it's really a great extension with a convenient shell tool. One thing to mention is, I think it's better to allow user to specify the table names since in many cases people have different table naming convention,it's more flexible for developers. Keep on the great work!

Leave a comment

Please to leave your comment.

Create extension
Downloads
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: oleksiy
  • Category: Auth
  • Votes: +4
  • Downloaded: 1,740 times
  • Created on: Feb 25, 2009
  • Last updated: Feb 28, 2009