adds abilities for SpendingProposals

This commit is contained in:
Juanjo Bazán
2015-12-30 14:18:44 +01:00
committed by Juanjo Bazán
parent fe32162c9f
commit 2c36ceb10c
6 changed files with 12 additions and 4 deletions

View File

@@ -30,4 +30,4 @@ class Moderation::UsersController < Moderation::BaseController
Activity.log(current_user, :block, @user) Activity.log(current_user, :block, @user)
end end
end end

View File

@@ -17,9 +17,12 @@ module Abilities
proposal.editable_by?(user) proposal.editable_by?(user)
end end
can :read, SpendingProposal
can :create, Comment can :create, Comment
can :create, Debate can :create, Debate
can :create, Proposal can :create, Proposal
can :create, SpendingProposal
can [:flag, :unflag], Comment can [:flag, :unflag], Comment
cannot [:flag, :unflag], Comment, user_id: user.id cannot [:flag, :unflag], Comment, user_id: user.id

View File

@@ -6,6 +6,7 @@ module Abilities
can :read, Debate can :read, Debate
can :read, Proposal can :read, Proposal
can :read, Comment can :read, Comment
can :read, SpendingProposal
can :read, Legislation can :read, Legislation
can :read, User can :read, User
can [:search, :read], Annotation can [:search, :read], Annotation

View File

@@ -79,6 +79,4 @@
<%= f.submit(class: "button radius", value: t("proposals.#{action_name}.form.submit_button")) %> <%= f.submit(class: "button radius", value: t("proposals.#{action_name}.form.submit_button")) %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@@ -28,6 +28,9 @@ describe "Abilities::Common" do
it { should_not be_able_to(:vote, Proposal) } it { should_not be_able_to(:vote, Proposal) }
it { should_not be_able_to(:vote_featured, Proposal) } it { should_not be_able_to(:vote_featured, Proposal) }
it { should be_able_to(:index, SpendingProposal) }
it { should be_able_to(:create, SpendingProposal) }
it { should_not be_able_to(:comment_as_administrator, debate) } it { should_not be_able_to(:comment_as_administrator, debate) }
it { should_not be_able_to(:comment_as_moderator, debate) } it { should_not be_able_to(:comment_as_moderator, debate) }
it { should_not be_able_to(:comment_as_administrator, proposal) } it { should_not be_able_to(:comment_as_administrator, proposal) }

View File

@@ -23,4 +23,7 @@ describe "Abilities::Everyone" do
it { should_not be_able_to(:unflag, Proposal) } it { should_not be_able_to(:unflag, Proposal) }
it { should be_able_to(:show, Comment) } it { should be_able_to(:show, Comment) }
it { should be_able_to(:index, SpendingProposal) }
it { should_not be_able_to(:create, SpendingProposal) }
end end