SimpleAccessControl =================== Acknowledgements: I give all credit to Ezra and Technoweenie for their two plugins which inspired the interface design and a lot of the code for this one. SimpleAccessControl is a streamlined, intuitive authorisation system. It derives heavily from acl_system2 and has made clear some problems which plagued the author when first using it. Some fixes to acl_system2's design: * a normal Rails syntax: access_rule 'admin', :only => :index access_rule '(moderator || admin)', :only => :new * error handling for helper methods (permit? bombs out with current_user == nil) * one-line parser, easy to replace or alter * proper before_filter usage, meaning access rules are parsed only when needed * no overrideable default (which I found counter-intuitive in the end) Also, it has two methods, access_control and permit?, for those moving from acl_system2. But, let me stress, everyone likes a slightly different system, so this one may not be your style. I find it synchronises very well with the interface of Acts as Authenticated (even though I have modified it so much that it's now called Authenticated Cookie). INSTALLATION ============ Create the following migration: create_table "roles", :force => true do |t| t.column "title", :string end create_table "roles_users", :id => false, :force => true do |t| t.column "role_id", :integer t.column "user_id", :integer end Be sure to have a current_user method which returns the user object. USAGE ===== The plugin is automatically hooked into ActionController::Base. To use the plugin, you may optionally set up these two callbacks somewhere in or mixed into your ApplicationController: def permission_granted end def permission_denied end In your controllers, add access rules like so: access_rule 'admin', :only => :destroy access_rule 'user || admin', :only => [:new, :create, :edit, :update] Note the use of Ruby-style operators. These strings are real conditionals and should be treated as such. Every grouping of non-operator characters will be considered a role title. In your views, you can use the following: <% restrict_to 'admin || moderator' do %> <%= link_to "Admin Area", admin_area_url %> <% end %> AND <%= link_to("Admin Area", admin_area_url) if has_permission?('admin || moderator') %> There are also transitional methods which help you move from acl_system2 to this plugin -- I do this not to denegrate acl_system2 but because I did this for myself and decided to include it. The two systems are rather similar. VARIATION BY MABS29