Added role helper methods, and set some abilities

This commit is contained in:
2013-01-28 00:50:14 -05:00
parent 7718d68ecd
commit 55739c5fc8
3 changed files with 31 additions and 12 deletions

View File

@@ -4,7 +4,9 @@ class Ability
def initialize(user)
user ||= User.new
can :manage, :all if user.admin?
can :manage, :all if user.admin?
can :manage, Post if user.moderator?
can :read, Category, :state => true
can :read, Forum, :state => true, :category => { :state => true }
@@ -16,5 +18,7 @@ class Ability
can :create, Post, :topic => { :locked => false } unless user.new_record?
can :create, Topic unless user.new_record?
cannot :read, :all if user.banned?
end
end