Merge pull request #993 from consul/permissions-change
Permissions change
This commit is contained in:
@@ -37,7 +37,7 @@ module Abilities
|
||||
|
||||
can :manage, Annotation
|
||||
|
||||
can :manage, SpendingProposal
|
||||
can [:read, :update], SpendingProposal
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ module Abilities
|
||||
include CanCan::Ability
|
||||
|
||||
def initialize(user)
|
||||
can :manage, SpendingProposal
|
||||
can [:read, :update, :valuate], SpendingProposal
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -4,7 +4,7 @@
|
||||
<td>
|
||||
<%= link_to spending_proposal.title, spending_proposal %>
|
||||
|
||||
<% if current_user && current_user.id == spending_proposal.author_id %>
|
||||
<% if can?(:destroy, spending_proposal) %>
|
||||
<%= link_to t("users.show.delete_spending_proposal"),
|
||||
spending_proposal,
|
||||
method: :delete,
|
||||
|
||||
@@ -202,7 +202,7 @@ feature 'Users' do
|
||||
feature 'Spending proposals' do
|
||||
|
||||
background do
|
||||
@author = create(:user)
|
||||
@author = create(:user, :level_two)
|
||||
@spending_proposal = create(:spending_proposal, author: @author, title: 'Build a school')
|
||||
end
|
||||
|
||||
|
||||
@@ -52,5 +52,7 @@ describe "Abilities::Administrator" do
|
||||
|
||||
it { should be_able_to(:manage, Annotation) }
|
||||
|
||||
it { should be_able_to(:manage, SpendingProposal) }
|
||||
it { should be_able_to(:read, SpendingProposal) }
|
||||
it { should be_able_to(:update, SpendingProposal) }
|
||||
it { should be_able_to(:valuate, SpendingProposal) }
|
||||
end
|
||||
|
||||
@@ -6,5 +6,7 @@ describe "Abilities::Valuator" do
|
||||
let(:user) { valuator.user }
|
||||
let(:valuator) { create(:valuator) }
|
||||
|
||||
it { should be_able_to(:manage, SpendingProposal) }
|
||||
it { should be_able_to(:read, SpendingProposal) }
|
||||
it { should be_able_to(:update, SpendingProposal) }
|
||||
it { should be_able_to(:valuate, SpendingProposal) }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user