Updates abilities for the new organisations

Note that unverified organisations can now create debates and comments
- that is a change over the initial request
This commit is contained in:
kikito
2015-08-13 20:03:38 +02:00
parent 19db7f9dda
commit b4b69d89e7
2 changed files with 21 additions and 34 deletions

View File

@@ -13,24 +13,19 @@ class Ability
debate.editable_by?(user)
end
can :create, Comment
can :create, Debate
unless user.organization?
can :vote, Debate
can :vote, Comment
end
if !user.organization? || user.verified_organization?
can :create, Comment
can :create, Debate
end
if user.moderator? || user.administrator?
can :verify_organization, User do |u|
!u.verified_organization?
end
can :reject_organization, User do |u|
!u.rejected_organization?
end
can :read, Organization
can(:verify, Organization){ |o| !o.verified? }
can(:reject, Organization){ |o| !o.rejected? }
elsif user.administrator?