Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c32e6125
Commit
c32e6125
authored
Jun 15, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of Gitlab::ShellEnv
parent
a4a85c26
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
37 deletions
+13
-37
app/services/git_hooks_service.rb
app/services/git_hooks_service.rb
+1
-1
lib/gitlab/backend/grack_auth.rb
lib/gitlab/backend/grack_auth.rb
+0
-7
lib/gitlab/backend/shell_env.rb
lib/gitlab/backend/shell_env.rb
+0
-28
lib/gitlab/gl_id.rb
lib/gitlab/gl_id.rb
+11
-0
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+1
-1
No files found.
app/services/git_hooks_service.rb
View file @
c32e6125
...
...
@@ -3,7 +3,7 @@ class GitHooksService
def
execute
(
user
,
repo_path
,
oldrev
,
newrev
,
ref
)
@repo_path
=
repo_path
@user
=
Gitlab
::
ShellEnv
.
gl_id
(
user
)
@user
=
Gitlab
::
GlId
.
gl_id
(
user
)
@oldrev
=
oldrev
@newrev
=
newrev
@ref
=
ref
...
...
lib/gitlab/backend/grack_auth.rb
View file @
c32e6125
require_relative
'shell_env'
module
Grack
class
AuthSpawner
def
self
.
call
(
env
)
...
...
@@ -61,11 +59,6 @@ module Grack
end
@user
=
authenticate_user
(
login
,
password
)
if
@user
Gitlab
::
ShellEnv
.
set_env
(
@user
)
@env
[
'REMOTE_USER'
]
=
@auth
.
username
end
end
def
ci_request?
(
login
,
password
)
...
...
lib/gitlab/backend/shell_env.rb
deleted
100644 → 0
View file @
a4a85c26
module
Gitlab
# This module provide 2 methods
# to set specific ENV variables for GitLab Shell
module
ShellEnv
extend
self
def
set_env
(
user
)
# Set GL_ID env variable
if
user
ENV
[
'GL_ID'
]
=
gl_id
(
user
)
end
end
def
reset_env
# Reset GL_ID env variable
ENV
[
'GL_ID'
]
=
nil
end
def
gl_id
(
user
)
if
user
.
present?
"user-
#{
user
.
id
}
"
else
# This empty string is used in the render_grack_auth_ok method
""
end
end
end
end
lib/gitlab/gl_id.rb
0 → 100644
View file @
c32e6125
module
Gitlab
module
GlId
def
self
.
gl_id
(
user
)
if
user
.
present?
"user-
#{
user
.
id
}
"
else
""
end
end
end
end
lib/gitlab/workhorse.rb
View file @
c32e6125
...
...
@@ -8,7 +8,7 @@ module Gitlab
class
<<
self
def
git_http_ok
(
repository
,
user
)
{
'GL_ID'
=>
Gitlab
::
ShellEnv
.
gl_id
(
user
),
'GL_ID'
=>
Gitlab
::
GlId
.
gl_id
(
user
),
'RepoPath'
=>
repository
.
path_to_repo
,
}
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment