BigW Consortium Gitlab

Commit 47270e1c by Adam Niedzielski

Backport changes from gitlab-org/gitlab-ee!1406

parent 32da7602
module Gitlab
module Checks
class ChangeAccess
attr_reader :user_access, :project, :skip_authorization
# protocol is currently used only in EE
attr_reader :user_access, :project, :skip_authorization, :protocol
def initialize(
change, user_access:, project:, env: {}, skip_authorization: false)
change, user_access:, project:, env: {}, skip_authorization: false,
protocol:
)
@oldrev, @newrev, @ref = change.values_at(:oldrev, :newrev, :ref)
@branch_name = Gitlab::Git.branch_name(@ref)
@user_access = user_access
@project = project
@env = env
@skip_authorization = skip_authorization
@protocol = protocol
end
def exec
......
......@@ -153,7 +153,9 @@ module Gitlab
user_access: user_access,
project: project,
env: @env,
skip_authorization: deploy_key?).exec
skip_authorization: deploy_key?,
protocol: protocol
).exec
end
def matching_merge_request?(newrev, branch_name)
......
......@@ -12,8 +12,16 @@ describe Gitlab::Checks::ChangeAccess, lib: true do
ref: 'refs/heads/master'
}
end
subject { described_class.new(changes, project: project, user_access: user_access).exec }
let(:protocol) { 'ssh' }
subject do
described_class.new(
changes,
project: project,
user_access: user_access,
protocol: protocol
).exec
end
before { allow(user_access).to receive(:can_do_action?).with(:push_code).and_return(true) }
......
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