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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
76cf7f34
Commit
76cf7f34
authored
May 26, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use 403 instead 404 for unpermitted actions
parent
726dd584
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
app/controllers/projects/issue_links_controller.rb
app/controllers/projects/issue_links_controller.rb
+2
-4
spec/controllers/projects/issue_links_controller_spec.rb
spec/controllers/projects/issue_links_controller_spec.rb
+6
-6
No files found.
app/controllers/projects/issue_links_controller.rb
View file @
76cf7f34
...
...
@@ -16,9 +16,7 @@ module Projects
def
destroy
issue_link
=
IssueLink
.
find
(
params
[
:id
])
# In order to remove a given relation, one must be allowed to admin_issue_link both the current
# project and on the related issue project.
return
render_404
unless
can?
(
current_user
,
:admin_issue_link
,
issue_link
.
target
.
project
)
return
render_403
unless
can?
(
current_user
,
:admin_issue_link
,
issue_link
.
target
.
project
)
result
=
IssueLinks
::
DestroyService
.
new
(
issue_link
,
current_user
).
execute
...
...
@@ -32,7 +30,7 @@ module Projects
end
def
authorize_admin_issue_link!
render_40
4
unless
can?
(
current_user
,
:admin_issue_link
,
@project
)
render_40
3
unless
can?
(
current_user
,
:admin_issue_link
,
@project
)
end
def
issue
...
...
spec/controllers/projects/issue_links_controller_spec.rb
View file @
76cf7f34
...
...
@@ -77,8 +77,8 @@ describe Projects::IssueLinksController, type: :controller do
context
'when unauthorized'
do
let
(
:user_role
)
{
:guest
}
it
'returns 40
4
'
do
is_expected
.
to
have_http_status
(
40
4
)
it
'returns 40
3
'
do
is_expected
.
to
have_http_status
(
40
3
)
end
end
...
...
@@ -128,8 +128,8 @@ describe Projects::IssueLinksController, type: :controller do
context
'when no authorization on current project'
do
let
(
:current_project_user_role
)
{
:guest
}
it
'returns 40
4
'
do
is_expected
.
to
have_http_status
(
40
4
)
it
'returns 40
3
'
do
is_expected
.
to
have_http_status
(
40
3
)
end
end
...
...
@@ -137,8 +137,8 @@ describe Projects::IssueLinksController, type: :controller do
let
(
:referenced_issue
)
{
create
:issue
}
let
(
:current_project_user_role
)
{
:developer
}
it
'returns 40
4
'
do
is_expected
.
to
have_http_status
(
40
4
)
it
'returns 40
3
'
do
is_expected
.
to
have_http_status
(
40
3
)
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