Commit 5b6202cc authored by Grzegorz Bizon's avatar Grzegorz Bizon

Do not show play action if user not allowed to run it

parent 3dbef510
...@@ -10,7 +10,7 @@ module Gitlab ...@@ -10,7 +10,7 @@ module Gitlab
end end
def has_action? def has_action?
can?(user, :update_build, subject) can?(user, :update_build, subject) && subject.can_play?(user)
end end
def action_icon def action_icon
......
...@@ -17,11 +17,19 @@ describe Gitlab::Ci::Status::Build::Play do ...@@ -17,11 +17,19 @@ describe Gitlab::Ci::Status::Build::Play do
describe '#has_action?' do describe '#has_action?' do
context 'when user is allowed to update build' do context 'when user is allowed to update build' do
before { build.project.team << [user, :developer] } context 'when user can push to branch' do
before { build.project.add_master(user) }
it { is_expected.to have_action } it { is_expected.to have_action }
end end
context 'when user can not push to the branch' do
before { build.project.add_developer(user) }
it { is_expected.not_to have_action }
end
end
context 'when user is not allowed to update build' do context 'when user is not allowed to update build' do
it { is_expected.not_to have_action } it { is_expected.not_to have_action }
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment