part of the family
beyond corporate purpose

Roleify, a Rails authorization plugin

05 Jun 2009

Today I’ve pushed a few updates to the Roleify rails plugin.

The changes are

  • you can now use ‘namespaced’ controllers
  • I added a helper method to hide/show blocks for a specified role


The initializer

Roleify::Role.configure("role_a", "role_b") do
    :role_a => { :dashboard_issues =>  :all },
    :role_b => { :issues => "index" }

So, role_a refers to a Dashboard::IssuesController and role_b refers to an IssuesController.

The helper

module ApplicationHelper
  include Roleify::RoleifyableHelper

The view

<% allowed?(Roleify::Role::ROLE_A) do %>
  // whatever you want for role_a eyes only
<% end %>

More info on GitHub.

blog comments powered by Disqus