diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2019-04-03 14:06:47 +0200 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2019-04-03 14:06:47 +0200 |
commit | 48c5f6c8ca4549a22b4f179fbd472146fa2aa002 (patch) | |
tree | d880785bb8f9641578485c1f41e1d4abf9a218d2 /lib/gitlab_access.rb | |
parent | 433cc96551a6d1f1621f9e105b1e7eb1ccc41b7a (diff) | |
download | gitlab-shell-remove-hooks.tar.gz |
Remove hooks, they belong to Gitaly nowremove-hooks
Diffstat (limited to 'lib/gitlab_access.rb')
-rw-r--r-- | lib/gitlab_access.rb | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/lib/gitlab_access.rb b/lib/gitlab_access.rb deleted file mode 100644 index 72abd14..0000000 --- a/lib/gitlab_access.rb +++ /dev/null @@ -1,43 +0,0 @@ -require_relative 'gitlab_init' -require_relative 'gitlab_net' -require_relative 'gitlab_access_status' -require_relative 'gitlab_metrics' -require_relative 'object_dirs_helper' -require 'json' - -class GitlabAccess - class AccessDeniedError < StandardError; end - - attr_reader :config, :gl_repository, :repo_path, :changes, :protocol - - def initialize(gl_repository, repo_path, actor, changes, protocol) - @config = GitlabConfig.new - @gl_repository = gl_repository - @repo_path = repo_path.strip - @actor = actor - @changes = changes.lines - @protocol = protocol - end - - def exec - status = GitlabMetrics.measure('check-access:git-receive-pack') do - api.check_access('git-receive-pack', @gl_repository, @repo_path, @actor, @changes, @protocol, env: ObjectDirsHelper.all_attributes.to_json) - end - - raise AccessDeniedError, status.message unless status.allowed? - - true - rescue GitlabNet::ApiUnreachableError - $stderr.puts "GitLab: Failed to authorize your Git request: internal API unreachable" - false - rescue AccessDeniedError => ex - $stderr.puts "GitLab: #{ex.message}" - false - end - - protected - - def api - GitlabNet.new - end -end |