BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
6cc6d973
Commit
6cc6d973
authored
Apr 06, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete dead code
parent
ac4d3dc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
52 deletions
+1
-52
grack_auth.rb
lib/gitlab/backend/grack_auth.rb
+1
-52
No files found.
lib/gitlab/backend/grack_auth.rb
View file @
6cc6d973
...
...
@@ -36,10 +36,7 @@ module Grack
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 @@ module Grack
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 @@ module Grack
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
...
...
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