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
664ee814
Commit
664ee814
authored
May 07, 2017
by
Robert Speicher
Committed by
Timothy Andrew
May 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'dz-restrict-autocomplete' into 'security-9-1'
Allow users autocomplete by author_id only for authenticated users See merge request !2100
parent
6a9efdc5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
autocomplete_controller.rb
app/controllers/autocomplete_controller.rb
+1
-1
dz-restrict-autocomplete.yml
changelogs/unreleased/dz-restrict-autocomplete.yml
+4
-0
autocomplete_controller_spec.rb
spec/controllers/autocomplete_controller_spec.rb
+12
-2
No files found.
app/controllers/autocomplete_controller.rb
View file @
664ee814
...
@@ -21,7 +21,7 @@ class AutocompleteController < ApplicationController
...
@@ -21,7 +21,7 @@ class AutocompleteController < ApplicationController
@users
=
[
current_user
,
*
@users
].
uniq
@users
=
[
current_user
,
*
@users
].
uniq
end
end
if
params
[
:author_id
].
present?
if
params
[
:author_id
].
present?
&&
current_user
author
=
User
.
find_by_id
(
params
[
:author_id
])
author
=
User
.
find_by_id
(
params
[
:author_id
])
@users
=
[
author
,
*
@users
].
uniq
if
author
@users
=
[
author
,
*
@users
].
uniq
if
author
end
end
...
...
changelogs/unreleased/dz-restrict-autocomplete.yml
0 → 100644
View file @
664ee814
---
title
:
Allow users autocomplete by author_id only for authenticated users
merge_request
:
author
:
spec/controllers/autocomplete_controller_spec.rb
View file @
664ee814
...
@@ -156,12 +156,13 @@ describe AutocompleteController do
...
@@ -156,12 +156,13 @@ describe AutocompleteController do
end
end
context
'author of issuable included'
do
context
'author of issuable included'
do
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
context
'authenticated'
do
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
end
end
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
it
'includes the author'
do
it
'includes the author'
do
get
(
:users
,
author_id:
non_member
.
id
)
get
(
:users
,
author_id:
non_member
.
id
)
...
@@ -175,6 +176,15 @@ describe AutocompleteController do
...
@@ -175,6 +176,15 @@ describe AutocompleteController do
end
end
end
end
context
'without authenticating'
do
it
'returns empty result'
do
get
(
:users
,
author_id:
non_member
.
id
)
expect
(
body
).
to
be_empty
end
end
end
context
'skip_users parameter included'
do
context
'skip_users parameter included'
do
before
{
sign_in
(
user
)
}
before
{
sign_in
(
user
)
}
...
...
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