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
Kazuhiko Shiozaki
gitlab-ce
Commits
dad83166
Commit
dad83166
authored
Oct 16, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5350 from NARKOZ/patch-0
fix variable name
parents
9afc930b
12420a22
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
11 deletions
+3
-11
app/models/user.rb
app/models/user.rb
+1
-5
lib/api/helpers.rb
lib/api/helpers.rb
+2
-6
No files found.
app/models/user.rb
View file @
dad83166
...
...
@@ -199,11 +199,7 @@ class User < ActiveRecord::Base
end
def
by_username_or_id
(
name_or_id
)
if
(
name_or_id
.
is_a?
(
Integer
))
User
.
find_by_id
(
name_or_id
)
else
User
.
find_by_username
(
name_or_id
)
end
where
(
'username = ? OR id = ?'
,
name_or_id
,
name_or_id
).
first
end
def
build_user
(
attrs
=
{},
options
=
{})
...
...
lib/api/helpers.rb
View file @
dad83166
...
...
@@ -11,12 +11,8 @@ module API
# 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?
begin
@current_user
=
User
.
by_username_or_id
(
identifier
)
rescue
=>
ex
not_found!
(
"No user id or username for:
#{
identifier
}
"
)
end
not_found!
(
"No user id or username for:
#{
identifier
}
"
)
if
current_user
.
nil?
not_found!
(
"No user id or username for:
#{
identifier
}
"
)
if
@current_user
.
nil?
end
@current_user
end
...
...
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