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
Boxiang Sun
gitlab-ce
Commits
0b67d7a0
Commit
0b67d7a0
authored
Jul 10, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix user autocomplete for unauthenticated users accessing public projects
Closes #1955
parent
3f5a4ae5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
CHANGELOG
CHANGELOG
+1
-0
app/controllers/autocomplete_controller.rb
app/controllers/autocomplete_controller.rb
+5
-1
spec/controllers/autocomplete_controller_spec.rb
spec/controllers/autocomplete_controller_spec.rb
+24
-0
No files found.
CHANGELOG
View file @
0b67d7a0
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 7.13.0 (unreleased)
v 7.13.0 (unreleased)
- Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
- Add branch switching support for graphs (Daniel Gerhardt)
- Add branch switching support for graphs (Daniel Gerhardt)
- Fix external issue tracker hook/test for HTTPS URLs (Daniel Gerhardt)
- Fix external issue tracker hook/test for HTTPS URLs (Daniel Gerhardt)
...
...
app/controllers/autocomplete_controller.rb
View file @
0b67d7a0
class
AutocompleteController
<
ApplicationController
class
AutocompleteController
<
ApplicationController
skip_before_action
:authenticate_user!
,
only:
[
:users
]
def
users
def
users
@users
=
@users
=
if
params
[
:project_id
].
present?
if
params
[
:project_id
].
present?
...
@@ -13,8 +15,10 @@ class AutocompleteController < ApplicationController
...
@@ -13,8 +15,10 @@ class AutocompleteController < ApplicationController
if
can?
(
current_user
,
:read_group
,
group
)
if
can?
(
current_user
,
:read_group
,
group
)
group
.
users
group
.
users
end
end
els
e
els
if
current_user
User
.
all
User
.
all
else
User
.
none
end
end
@users
=
@users
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@users
=
@users
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
...
...
spec/controllers/autocomplete_controller_spec.rb
View file @
0b67d7a0
...
@@ -48,4 +48,28 @@ describe AutocompleteController do
...
@@ -48,4 +48,28 @@ describe AutocompleteController do
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
User
.
count
}
it
{
expect
(
body
.
size
).
to
eq
User
.
count
}
end
end
context
'unauthenticated user'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
describe
'GET #users with public project'
do
before
do
project
.
team
<<
[
user
,
:guest
]
get
(
:users
,
project_id:
project
.
id
)
end
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
1
}
end
describe
'GET #users with no project'
do
before
do
get
(
:users
)
end
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
0
}
end
end
end
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