summaryrefslogtreecommitdiff
path: root/lib/gitlab_net.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r--lib/gitlab_net.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index 6397106..65c2828 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -6,21 +6,17 @@ require_relative 'gitlab_config'
require_relative 'gitlab_logger'
class GitlabNet
- def allowed?(cmd, repo, actor, ref, oldrev = nil, newrev = nil, forced_push = false)
+ def allowed?(cmd, repo, actor, changes)
project_name = repo.gsub("'", "")
project_name = project_name.gsub(/\.git\Z/, "")
project_name = project_name.gsub(/\A\//, "")
params = {
action: cmd,
- ref: ref,
+ changes: changes,
project: project_name,
- forced_push: forced_push,
}
- params.merge!(oldrev: oldrev) if oldrev
- params.merge!(newrev: newrev) if newrev
-
if actor =~ /\Akey\-\d+\Z/
params.merge!(key_id: actor.gsub("key-", ""))
elsif actor =~ /\Auser\-\d+\Z/
@@ -86,7 +82,7 @@ class GitlabNet
end
def cert_store
- @cert_store ||= OpenSSL::X509::Store.new.tap { |store|
+ @cert_store ||= OpenSSL::X509::Store.new.tap do |store|
store.set_default_paths
if ca_file = config.http_settings['ca_file']
@@ -96,6 +92,6 @@ class GitlabNet
if ca_path = config.http_settings['ca_path']
store.add_path(ca_path)
end
- }
+ end
end
end