Roleify, a Rails authorization plugin
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
Example
The initializer
Roleify::Role.configure("role_a", "role_b") do
{
:role_a => { :dashboard_issues => :all },
:role_b => { :issues => "index" }
}
end
So, role_a refers to a Dashboard::IssuesController and role_b refers to an IssuesController.
The helper
module ApplicationHelper
include Roleify::RoleifyableHelper
end
The view
<% allowed?(Roleify::Role::ROLE_A) do %>
// whatever you want for role_a eyes only
<% end %>
More info on GitHub.
