diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-02 09:17:43 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-02 09:17:43 +0000 |
commit | 76f7f349669524809db2daa34d07d4af9b9e9544 (patch) | |
tree | e5e020d921f454b1f61b903e76e31d37a5ffaeb4 /lib/gitlab_net.rb | |
parent | 99fa0c6e878ed7e5e6292a87524bd43edfafbc9f (diff) | |
parent | a71c80721de28e59147dc6b8c8326c98570a1cb8 (diff) | |
download | gitlab-shell-76f7f349669524809db2daa34d07d4af9b9e9544.tar.gz |
Merge branch 'hooks-refactoring' into 'master'
Hooks refactoring
* replace update hook with pre-receive & post-receive hooks
* use pre-receive hook for authorisation
* use post-receive hook to create background job for GitLab worker
Related to https://dev.gitlab.org/gitlab/gitlabhq/issues/1516
See merge request !38
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r-- | lib/gitlab_net.rb | 12 |
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 |