updated readme

This commit is contained in:
Mike Kelley
2011-08-27 01:41:48 -06:00
commit 17fee3c6d5
98 changed files with 11421 additions and 0 deletions

20
app/models/ability.rb Normal file
View File

@@ -0,0 +1,20 @@
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :manage, :all if user.admin?
can :read, Category, :state => true
can :read, Forum, :state => true, :category => { :state => true }
can :read, Topic, :forum => { :state => true, :category => { :state => true } }
can :read, Post, :topic => { :forum => { :state => true, :category => { :state => true } } }
can :update, Post, :user_id => user.id
can :destroy, [Topic,Post], :user_id => user.id
can :create, Post unless user.new_record?
can :create, Topic unless user.new_record?
end
end