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 (
commit ff6180dc00afc474fa1d54965c50ef046325aa6b
tree 54f56bae66c94efde5d6f1a765fe232aa0ef6f6a
parent e698c571450ce3e9c0a50f6cd7079f850836e45f
tree 54f56bae66c94efde5d6f1a765fe232aa0ef6f6a
parent e698c571450ce3e9c0a50f6cd7079f850836e45f
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Mon Aug 11 23:56:01 -0700 2008 | |
| |
README | Wed Aug 13 23:11:11 -0700 2008 | |
| |
Rakefile | Mon Aug 11 23:56:01 -0700 2008 | |
| |
init.rb | Mon Aug 11 23:56:01 -0700 2008 | |
| |
install.rb | Mon Aug 11 23:56:01 -0700 2008 | |
| |
lib/ | Thu Aug 14 00:22:06 -0700 2008 | |
| |
tasks/ | Wed Aug 13 23:13:58 -0700 2008 | |
| |
test/ | Wed Aug 13 23:13:58 -0700 2008 | |
| |
uninstall.rb | Mon Aug 11 23:56:01 -0700 2008 |
README
ActsAsCheckpoint
================
This plugin provides a very simple syntax for setting up complex permissions.
Example for Controllers
=======================
Role-oriented approach:
class YourController < ApplicationController
acts_as_checkpoint :get_user_method => :current_user
controller_allows :administrator, :to => [ :index, :show, :destroy ]
controller_allows :registered_user, :to => [ :index, :show, :new, :edit, :create, :update ]
controller_allows :anonymous_user, :to => [ :index, :show ]
end
Action-oriented approach:
class YourController < ApplicationController
acts_as_checkpoint :get_user_method => :current_user
controller_allows :index , :by => [ :administrator, :registered_user, :anonymous_user ]
controller_allows :show , :by => [ :administrator, :registered_user ]
controller_allows :new , :by => :registered_user
controller_allows :edit , :by => :registered_user
controller_allows :create , :by => :registered_user
controller_allows :update , :by => :registered_user
controller_allows :destroy, :by => :administrator
end
The two approaches may be interspersed at will... just try not to get confused.
Example for Models
==================
class Dog < ActiveRecord::Base
belongs_to :owner
acts_as_checkpoint
model_may :eat, :drink, :lick
model_allows :lick, :by => :self
model_allows :pet, :by => :owner
end
class Human < ActiveRecord::Base
has_many :dogs
acts_as_checkpoint
model_may :pet
model_allows :lick, :by => :dogs
end
human = Human.new
dog = Dog.new( :owner => human )
human.can_pet?( dog )
# => true
dog.can_eat?( human )
# => false
dog.can_lick?( human )
# => true
Copyright (c) 2008 Brian Langenfeld, released under the MIT license







