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
Léo-Paul Géneau
gitlab-ce
Commits
e48313f7
Commit
e48313f7
authored
Nov 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'api_token_cast' of /home/git/repositories/gitlab/gitlabhq into 6-2-stable
parents
b490fded
39090482
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
VERSION
VERSION
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+6
-1
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+1
-1
No files found.
VERSION
View file @
e48313f7
6.2.
3
6.2.
4
lib/api/helpers.rb
View file @
e48313f7
...
...
@@ -6,19 +6,23 @@ module API
SUDO_PARAM
=
:sudo
def
current_user
@current_user
||=
User
.
find_by_authentication_token
(
params
[
PRIVATE_TOKEN_PARAM
]
||
env
[
PRIVATE_TOKEN_HEADER
])
private_token
=
(
params
[
PRIVATE_TOKEN_PARAM
]
||
env
[
PRIVATE_TOKEN_HEADER
]).
to_s
@current_user
||=
User
.
find_by_authentication_token
(
private_token
)
identifier
=
sudo_identifier
()
# If the sudo is the current user do nothing
if
(
identifier
&&
!
(
@current_user
.
id
==
identifier
||
@current_user
.
username
==
identifier
))
render_api_error!
(
'403 Forbidden: Must be admin to use sudo'
,
403
)
unless
@current_user
.
is_admin?
@current_user
=
User
.
by_username_or_id
(
identifier
)
not_found!
(
"No user id or username for:
#{
identifier
}
"
)
if
@current_user
.
nil?
end
@current_user
end
def
sudo_identifier
()
identifier
||=
params
[
SUDO_PARAM
]
||=
env
[
SUDO_HEADER
]
# Regex for integers
if
(
!!
(
identifier
=~
/^[0-9]+$/
))
identifier
.
to_i
...
...
@@ -29,6 +33,7 @@ module API
def
set_current_user_for_thread
Thread
.
current
[
:current_user
]
=
current_user
begin
yield
ensure
...
...
lib/tasks/gitlab/check.rake
View file @
e48313f7
...
...
@@ -736,7 +736,7 @@ namespace :gitlab do
end
def
check_gitlab_shell
required_version
=
Gitlab
::
VersionInfo
.
new
(
1
,
7
,
4
)
required_version
=
Gitlab
::
VersionInfo
.
new
(
1
,
7
,
8
)
current_version
=
Gitlab
::
VersionInfo
.
parse
(
gitlab_shell_version
)
print
"GitLab Shell version >=
#{
required_version
}
? ... "
...
...
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