Added role helper methods, and set some abilities
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user