Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
6cc6d973
Commit
6cc6d973
authored
8 years ago
by
Jacob Vosmaer
Browse files
Options
Downloads
Patches
Plain Diff
Delete dead code
parent
ac4d3dc5
No related branches found
No related tags found
2 merge requests
!450
CE upstream
,
!446
Git HTTP Controller: EE
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/gitlab/backend/grack_auth.rb
+1
-52
1 addition, 52 deletions
lib/gitlab/backend/grack_auth.rb
with
1 addition
and
52 deletions
lib/gitlab/backend/grack_auth.rb
+
1
−
52
View file @
6cc6d973
...
...
@@ -36,10 +36,7 @@ def call(env)
lfs_response
=
Gitlab
::
Lfs
::
Router
.
new
(
project
,
@user
,
@request
).
try_call
return
lfs_response
unless
lfs_response
.
nil?
if
project
&&
authorized_request?
# Tell gitlab-workhorse the request is OK, and what the GL_ID is
render_grack_auth_ok
elsif
@user
.
nil?
&&
!
@ci
if
@user
.
nil?
&&
!
@ci
unauthorized
else
render_not_found
...
...
@@ -141,36 +138,6 @@ def authenticate_user(login, password)
user
end
def
authorized_request?
return
true
if
@ci
case
git_cmd
when
*
Gitlab
::
GitAccess
::
DOWNLOAD_COMMANDS
if
!
Gitlab
.
config
.
gitlab_shell
.
upload_pack
false
elsif
user
Gitlab
::
GitAccess
.
new
(
user
,
project
).
download_access_check
.
allowed?
elsif
project
.
public?
# Allow clone/fetch for public projects
true
else
false
end
when
*
Gitlab
::
GitAccess
::
PUSH_COMMANDS
if
!
Gitlab
.
config
.
gitlab_shell
.
receive_pack
false
elsif
user
# Skip user authorization on upload request.
# It will be done by the pre-receive hook in the repository.
true
else
false
end
else
false
end
end
def
git_cmd
if
@request
.
get?
@request
.
params
[
'service'
]
...
...
@@ -197,24 +164,6 @@ def project_by_path(path)
end
end
def
render_grack_auth_ok
repo_path
=
if
@request
.
path_info
=~
/^([\w\.\/-]+)\.wiki\.git/
ProjectWiki
.
new
(
project
).
repository
.
path_to_repo
else
project
.
repository
.
path_to_repo
end
[
200
,
{
"Content-Type"
=>
"application/json"
},
[
JSON
.
dump
({
'GL_ID'
=>
Gitlab
::
ShellEnv
.
gl_id
(
@user
),
'RepoPath'
=>
repo_path
,
})]
]
end
def
render_not_found
[
404
,
{
"Content-Type"
=>
"text/plain"
},
[
"Not Found"
]]
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment