Wes Gibbs home

Zuul, a simple role-based authorization library

I recently extracted some authorization code that has proven its worth in a couple projects. The result is Zuul.

Quick start

sudo gem install zuul --source http://gemcutter.org

Zuul expects that your controllers have a current_user method available.

Add a role to your users table.

add_column :users, :role, :string

In your User model, specify the valid roles.

valid_roles :guest, :member, :admin

In your ApplicationController, enable access restrictions.

include Zuul::RestrictAccess
restrict_access

In your controllers, specify which roles are allowed for which actions.

require_user :guest, :admin, :only => :index, :show

 

Learn more

The gem is available at gemcutter. The source, additional examples and documentation can be found on github.