This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon Mar 09 02:30:18 -0700 2009 | |
| |
LICENSE | Mon Mar 09 02:08:08 -0700 2009 | |
| |
README.rdoc | Sat Apr 18 05:04:01 -0700 2009 | |
| |
Rakefile | Mon Mar 09 13:32:33 -0700 2009 | |
| |
VERSION.yml | Sat Apr 18 04:56:41 -0700 2009 | |
| |
authorization-san.gemspec | Sat Apr 18 04:57:45 -0700 2009 | |
| |
examples/ | Mon Jun 15 04:53:04 -0700 2009 | |
| |
lib/ | Fri Jun 12 22:46:15 -0700 2009 | |
| |
rails/ | Mon Mar 09 02:30:18 -0700 2009 | |
| |
test/ | Fri Jun 12 22:40:31 -0700 2009 |
README.rdoc
Authorization-San
Authorization-san allows you to specify access policies in your controllers. The plugin assumes a number of things about the application.
- If a user has authenticated with the application, it’s stored in @authenticated. The method of authentication doesn’t matter. It also doesn’t matter what you put in @authenticated, as long as it’s truthy.
- @authenticated has either a role attribute or a number of methods to query for the role: admin?, editor?, guest?. When the @authenticated object doesn’t have role methods you can’t use role based authentication rules, but the rest still works.
What does it look like?
class BooksController < ActionController::Base
# Visitors can see list of books and book pages
allow_access :all, :only => [:index, :show]
# An editor can create new books, but…
allow_access :editor, :only => [:new, :create]
# …she can only update her own books.
allow_access(:editor, :only => [:edit, :update]) { @book = @authenticated.books.find(params[:id]) }
# Admin users can do it all.
allow_access :admin
end
The best place to start learning more is the examples directory in the source.







