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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
7f44599e
Commit
7f44599e
authored
Jun 29, 2012
by
Saito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integrate with gitlabhq authority
parent
86807b8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
Gemfile.lock
Gemfile.lock
+1
-1
config/initializers/grack_auth.rb
config/initializers/grack_auth.rb
+27
-4
No files found.
Gemfile.lock
View file @
7f44599e
GIT
remote: https://github.com/SaitoWu/grack.git
revision:
dd990d231ac9189046b71a65d874638e55320e27
revision:
ba46f3b0845c6a09d488ae6abdce6ede37e227e8
specs:
grack (1.0.0)
rack (~> 1.4.1)
...
...
config/initializers/grack_auth.rb
View file @
7f44599e
...
...
@@ -2,7 +2,30 @@ module Grack
class
Auth
<
Rack
::
Auth
::
Basic
def
valid?
true
end
end
end
# Authentication with username and password
email
,
password
=
@auth
.
credentials
user
=
User
.
find_by_email
(
email
)
return
false
unless
user
.
valid_password?
(
password
)
# Find project by PATH_INFO from env
if
m
=
/^\/([\w-]+).git/
.
match
(
@env
[
'PATH_INFO'
]).
to_a
return
false
unless
project
=
Project
.
find_by_path
(
m
.
last
)
end
# Git upload and receive
if
@env
[
'REQUEST_METHOD'
]
==
'GET'
true
elsif
@env
[
'REQUEST_METHOD'
]
==
'POST'
if
@env
[
'REQUEST_URI'
].
end_with?
(
'git-upload-pack'
)
return
project
.
dev_access_for?
(
user
)
elsif
@env
[
'REQUEST_URI'
].
end_with?
(
'git-upload-pack'
)
#TODO master branch protection
return
project
.
dev_access_for?
(
user
)
else
false
end
end
end
# valid?
end
# Auth
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