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
iv
gitlab-ce
Commits
b698094d
Commit
b698094d
authored
Feb 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update post-receive worker to use correct identifier
parent
ed3f4408
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
app/workers/post_receive.rb
app/workers/post_receive.rb
+10
-6
lib/gitlab/backend/grack_auth.rb
lib/gitlab/backend/grack_auth.rb
+2
-5
No files found.
app/workers/post_receive.rb
View file @
b698094d
...
@@ -21,14 +21,18 @@ class PostReceive
...
@@ -21,14 +21,18 @@ class PostReceive
return
false
return
false
end
end
# Ignore push from non-gitlab users
user
=
if
identifier
.
blank?
user
=
if
identifier
.
nil?
# Local push from gitlab
raise
identifier
.
inspect
email
=
project
.
repository
.
commit
(
newrev
).
author
.
email
rescue
nil
email
=
project
.
repository
.
commit
(
newrev
).
author
.
email
rescue
nil
User
.
find_by_email
(
email
)
if
email
User
.
find_by_email
(
email
)
if
email
elsif
/^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/
.
match
(
identifier
)
User
.
find_by_email
(
identifier
)
elsif
identifier
=~
/\Auser-\d+\Z/
elsif
identifier
=~
/key/
# git push over http
user_id
=
identifier
.
gsub
(
"user-"
,
""
)
User
.
find_by_id
(
user_id
)
elsif
identifier
=~
/\Akey-\d+\Z/
# git push over ssh
key_id
=
identifier
.
gsub
(
"key-"
,
""
)
key_id
=
identifier
.
gsub
(
"key-"
,
""
)
Key
.
find_by_id
(
key_id
).
try
(
:user
)
Key
.
find_by_id
(
key_id
).
try
(
:user
)
end
end
...
...
lib/gitlab/backend/grack_auth.rb
View file @
b698094d
...
@@ -7,9 +7,6 @@ module Grack
...
@@ -7,9 +7,6 @@ module Grack
@request
=
Rack
::
Request
.
new
(
env
)
@request
=
Rack
::
Request
.
new
(
env
)
@auth
=
Request
.
new
(
env
)
@auth
=
Request
.
new
(
env
)
# Pass Gitolite update hook
ENV
[
'GL_BYPASS_UPDATE_HOOK'
]
=
"true"
# Need this patch due to the rails mount
# Need this patch due to the rails mount
@env
[
'PATH_INFO'
]
=
@request
.
path
@env
[
'PATH_INFO'
]
=
@request
.
path
@env
[
'SCRIPT_NAME'
]
=
""
@env
[
'SCRIPT_NAME'
]
=
""
...
@@ -35,8 +32,8 @@ module Grack
...
@@ -35,8 +32,8 @@ module Grack
self
.
user
=
User
.
find_by_email
(
login
)
||
User
.
find_by_username
(
login
)
self
.
user
=
User
.
find_by_email
(
login
)
||
User
.
find_by_username
(
login
)
return
false
unless
user
.
try
(
:valid_password?
,
password
)
return
false
unless
user
.
try
(
:valid_password?
,
password
)
# Set GL_
USER
env variable
# Set GL_
ID
env variable
ENV
[
'GL_
USER'
]
=
user
.
email
ENV
[
'GL_
ID'
]
=
"user-
#{
user
.
id
}
"
end
end
# Git upload and receive
# Git upload and receive
...
...
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