summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <dturner@twosigma.com>2017-08-03 14:38:33 -0400
committerDavid Turner <novalis@novalis.org>2017-09-29 18:16:55 -0400
commit01ce58bde4ddb9bdf3c54dbd2cc65f7a6b81661e (patch)
treebf4a2f8c34e09a5577b4935c0fed0c5d9eb8a7c1
parentdbcf48af8b21c0f1e54b73ea421911028081e1c1 (diff)
downloadgitlab-ce-01ce58bde4ddb9bdf3c54dbd2cc65f7a6b81661e.tar.gz
add username to authorized result, so that gitlab-shell can pass it to hooks
-rw-r--r--GITLAB_SHELL_VERSION3
-rw-r--r--lib/api/internal.rb7
-rw-r--r--lib/gitlab/git/hook.rb11
-rw-r--r--lib/gitlab/workhorse.rb2
4 files changed, 15 insertions, 8 deletions
diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION
index da902181863..5508e17c23b 100644
--- a/GITLAB_SHELL_VERSION
+++ b/GITLAB_SHELL_VERSION
@@ -1 +1,2 @@
-5.9.2
+5.9.3
+
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index a0557a609ca..6e78ac2c903 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -31,6 +31,12 @@ module API
protocol = params[:protocol]
actor.update_last_used_at if actor.is_a?(Key)
+ user =
+ if actor.is_a?(Key)
+ actor.user
+ else
+ actor
+ end
access_checker_klass = wiki? ? Gitlab::GitAccessWiki : Gitlab::GitAccess
access_checker = access_checker_klass
@@ -47,6 +53,7 @@ module API
{
status: true,
gl_repository: gl_repository,
+ gl_username: user&.username,
repository_path: repository_path,
gitaly: gitaly_payload(params[:action])
}
diff --git a/lib/gitlab/git/hook.rb b/lib/gitlab/git/hook.rb
index 8ccb3e64636..e29a1f7afa1 100644
--- a/lib/gitlab/git/hook.rb
+++ b/lib/gitlab/git/hook.rb
@@ -83,12 +83,11 @@ module Gitlab
def call_update_hook(gl_id, gl_username, oldrev, newrev, ref)
Dir.chdir(repo_path) do
- stdout, stderr, status = Open3.capture3(
- {
- 'GL_ID' => gl_id,
- 'GL_USERNAME' => gl_username
- },
- path, ref, oldrev, newrev)
+ env = {
+ 'GL_ID' => gl_id,
+ 'GL_USERNAME' => gl_username
+ }
+ stdout, stderr, status = Open3.capture3(env, path, ref, oldrev, newrev)
[status.success?, (stderr.presence || stdout).gsub(/\R/, "<br>").html_safe]
end
end
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index 17550cf9074..45f246242f1 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -22,9 +22,9 @@ module Gitlab
params = {
GL_ID: Gitlab::GlId.gl_id(user),
GL_REPOSITORY: Gitlab::GlRepository.gl_repository(project, is_wiki),
+ GL_USERNAME: user&.username,
RepoPath: repo_path
}
-
server = {
address: Gitlab::GitalyClient.address(project.repository_storage),
token: Gitlab::GitalyClient.token(project.repository_storage)