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
end
def has_action?
can?(user, :update_build, subject)
can?(user, :update_build, subject) && subject.can_play?(user)
end
def action_icon
......
......@@ -17,9 +17,17 @@ describe Gitlab::Ci::Status::Build::Play do
describe '#has_action?' 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
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
......
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