No commit activity in last 3 years
No release in over 3 years
Aegis is an authorization solution for Ruby on Rails that supports roles and a RESTish, resource-style declaration of permission rules.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Aegis - A complete authorization solution for Rails¶ ↑

Aegis is an authorization solution for Ruby on Rails that supports roles and a RESTish, resource-style declaration of permission rules. Getting started with Aegis is easy and requires very little integration. As your authorization requirements become more complex, Aegis will grow with you.

End of life notice!¶ ↑

The authors of this gem have moved on to create Consul, our next-gen authorization solution. While Aegis remains a stable solution for Rails 2, this gem is not being developed further.

If you are looking for Rails 3+ support you might want to browse through forks of Aegis.

If you are interested in taking over future maintenance of Aegis, write to henning.koch@makandra.de regarding transfer of gem ownership. Please attach links to work you did on Aegis in a fork, so we can know you are serious about this.

Getting started¶ ↑

All your permissions live in a single class Permissions. Permissions are described using resources, similiar to your routes. Your permission resources can match those in your routes, but don’t have to.

Access to resources or individual actions can be granted or denied to specific roles.

class Permissions < Aegis::Permissions
  role :user
  role :admin
  resources :projects do
    allow :everyone
  end
  resources :users do
    allow :admin
  end
end

To give your user model a role, it needs to have an attribute role_name. The has_role macro wires everything together:

class User < ActiveRecord::Base
  has_role
end

You can now check if a user has permission to access a given action in your controllers and views:

<% if current_user.may_update_project? @project %>
  <%= link_to 'Edit', edit_project_path(@project) %>
<% end %>

You can protect all actions in a controller through an Aegis resource with a single line:

class ProjectsController < ApplicationController
  permissions :projects
end

Further reading¶ ↑

You are now familiar with the basic use case. Aegis can do a lot more than that. There is an awesome documentation wiki with detailed information on many basic and advanced topics, including:

Installation¶ ↑

Aegis is a gem, which you can install with

sudo gem install aegis

In Rails 2, add the following to your environment.rb:

config.gem 'aegis'

In Rails 3, add the following to your Gemfile:

gem 'aegis'

Compatibility¶ ↑

Aegis was tested in Rails 2 only. If you are looking for Rails 3+ support you might want to browse through forks of Aegis.

Credits¶ ↑

Henning Koch, Tobias Kraze

makandra.com

gem-session.com