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
8db947bc
Commit
8db947bc
authored
Jun 29, 2012
by
Saito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implements protected branches to smart http protocal
parent
7f44599e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
grack_auth.rb
config/initializers/grack_auth.rb
+19
-4
No files found.
config/initializers/grack_auth.rb
View file @
8db947bc
...
@@ -18,14 +18,29 @@ module Grack
...
@@ -18,14 +18,29 @@ module Grack
elsif
@env
[
'REQUEST_METHOD'
]
==
'POST'
elsif
@env
[
'REQUEST_METHOD'
]
==
'POST'
if
@env
[
'REQUEST_URI'
].
end_with?
(
'git-upload-pack'
)
if
@env
[
'REQUEST_URI'
].
end_with?
(
'git-upload-pack'
)
return
project
.
dev_access_for?
(
user
)
return
project
.
dev_access_for?
(
user
)
elsif
@env
[
'REQUEST_URI'
].
end_with?
(
'git-upload-pack'
)
elsif
@env
[
'REQUEST_URI'
].
end_with?
(
'git-receive-pack'
)
#TODO master branch protection
if
project
.
protected_branches
.
map
(
&
:name
).
include?
(
current_ref
)
return
project
.
dev_access_for?
(
user
)
project
.
master_access_for?
(
user
)
else
project
.
dev_access_for?
(
user
)
end
else
else
false
false
end
end
else
false
end
end
end
# valid?
end
# valid?
def
current_ref
if
@env
[
"HTTP_CONTENT_ENCODING"
]
=~
/gzip/
input
=
Zlib
::
GzipReader
.
new
(
@request
.
body
).
string
else
input
=
@request
.
body
.
string
end
oldrev
,
newrev
,
ref
=
input
.
split
(
' '
)
/refs\/heads\/([\w-]+)/
.
match
(
ref
).
to_a
.
last
end
end
# Auth
end
# Auth
end
# Grack
end
# Grack
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