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
360cd231
Commit
360cd231
authored
Jun 28, 2021
by
Jaime Martinez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix authorize for user_project instead of release
parent
8e011e66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
lib/api/releases.rb
lib/api/releases.rb
+3
-3
spec/requests/api/releases_spec.rb
spec/requests/api/releases_spec.rb
+4
-3
No files found.
lib/api/releases.rb
View file @
360cd231
...
...
@@ -60,10 +60,10 @@ module API
desc:
'If `true`, a response includes HTML rendered markdown of the release description.'
end
get
':id/releases/:tag_name'
,
requirements:
RELEASE_ENDPOINT_REQUIREMENTS
do
not_found!
unless
release
authorize_download_code!
not_found!
unless
release
present
release
,
with:
Entities
::
Release
,
current_user:
current_user
,
include_html_description:
params
[
:include_html_description
]
end
...
...
@@ -179,7 +179,7 @@ module API
end
def
authorize_download_code!
authorize!
:download_code
,
release
authorize!
:download_code
,
user_project
end
def
authorize_create_evidence!
...
...
spec/requests/api/releases_spec.rb
View file @
360cd231
...
...
@@ -467,6 +467,7 @@ RSpec.describe API::Releases do
get
api
(
"/projects/
#{
project
.
id
}
/releases/non_exist_tag"
,
maintainer
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Not Found'
)
end
it
'returns project not found for no user'
do
...
...
@@ -476,10 +477,10 @@ RSpec.describe API::Releases do
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Project Not Found'
)
end
it
'returns
404
for guest'
do
get
api
(
"/projects/
#{
project
.
id
}
/releases/non_exist_tag"
,
guest
)
it
'returns
forbidden
for guest'
do
get
api
(
"/projects/
#{
project
.
id
}
/releases/non_exist
ing
_tag"
,
guest
)
expect
(
response
).
to
have_gitlab_http_status
(
:
not_found
)
expect
(
response
).
to
have_gitlab_http_status
(
:
forbidden
)
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