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
182aa19e
Unverified
Commit
182aa19e
authored
Nov 20, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parse all refs when do push via HTTP and check permissions for all of them
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
3f3b202c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
grack_auth.rb
lib/gitlab/backend/grack_auth.rb
+14
-10
No files found.
lib/gitlab/backend/grack_auth.rb
View file @
182aa19e
...
...
@@ -82,13 +82,17 @@ module Grack
when
'git-upload-pack'
project
.
public
||
can?
(
user
,
:download_code
,
project
)
when
'git-receive-pack'
action
=
if
project
.
protected_branch?
(
ref
)
:push_code_to_protected_branches
else
:push_code
end
refs
.
each
do
|
ref
|
action
=
if
project
.
protected_branch?
(
ref
)
:push_code_to_protected_branches
else
:push_code
end
return
false
unless
can?
(
user
,
action
,
project
)
end
can?
(
user
,
action
,
project
)
true
else
false
end
...
...
@@ -108,11 +112,11 @@ module Grack
@project
||=
project_by_path
(
@request
.
path_info
)
end
def
ref
@ref
||=
parse_ref
def
ref
s
@ref
s
||=
parse_refs
end
def
parse_ref
def
parse_ref
s
input
=
if
@env
[
"HTTP_CONTENT_ENCODING"
]
=~
/gzip/
Zlib
::
GzipReader
.
new
(
@request
.
body
).
read
else
...
...
@@ -121,7 +125,7 @@ module Grack
# Need to reset seek point
@request
.
body
.
rewind
/refs\/heads\/([\/\w\.-]+)/n
.
match
(
input
.
force_encoding
(
'ascii-8bit'
)).
to_a
.
las
t
input
.
force_encoding
(
'ascii-8bit'
).
scan
(
/refs\/heads\/([\/\w\.-]+)/n
).
flatten
.
compac
t
end
end
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