Skip to content
Snippets Groups Projects
Commit 01ce58bd authored by David Turner (TS)'s avatar David Turner (TS) Committed by David Turner
Browse files

add username to authorized result, so that gitlab-shell can pass it to hooks

parent dbcf48af
No related branches found
No related tags found
1 merge request!3051CE upstream
5.9.2
5.9.3
......@@ -31,6 +31,12 @@ class Internal < Grape::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 @@ class Internal < Grape::API
{
status: true,
gl_repository: gl_repository,
gl_username: user&.username,
repository_path: repository_path,
gitaly: gitaly_payload(params[:action])
}
......
......@@ -83,12 +83,11 @@ def call_receive_hook(gl_id, gl_username, oldrev, newrev, ref)
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
......
......@@ -22,9 +22,9 @@ def git_http_ok(repository, is_wiki, user, action)
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment