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
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
post_receive.rb
app/workers/post_receive.rb
+10
-6
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
return
false
end
# Ignore push from non-gitlab users
user
=
if
identifier
.
nil?
raise
identifier
.
inspect
user
=
if
identifier
.
blank?
# Local push from gitlab
email
=
project
.
repository
.
commit
(
newrev
).
author
.
email
rescue
nil
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
=~
/key/
elsif
identifier
=~
/\Auser-\d+\Z/
# 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
.
find_by_id
(
key_id
).
try
(
:user
)
end
...
...
lib/gitlab/backend/grack_auth.rb
View file @
b698094d
...
...
@@ -7,9 +7,6 @@ module Grack
@request
=
Rack
::
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
@env
[
'PATH_INFO'
]
=
@request
.
path
@env
[
'SCRIPT_NAME'
]
=
""
...
...
@@ -35,8 +32,8 @@ module Grack
self
.
user
=
User
.
find_by_email
(
login
)
||
User
.
find_by_username
(
login
)
return
false
unless
user
.
try
(
:valid_password?
,
password
)
# Set GL_
USER
env variable
ENV
[
'GL_
USER'
]
=
user
.
email
# Set GL_
ID
env variable
ENV
[
'GL_
ID'
]
=
"user-
#{
user
.
id
}
"
end
# 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