Include authorization check in Npm::CreatePackageService
requested to merge gitlab-community/gitlab:418796-create-package-service-add-authorization into master
What does this MR do and why?
Based on the review discussion in another MR, this MR is intented as a follow-up of the MR !125415 (merged).
This MR includes:
- An authorization check for the given user in Npm::CreatePackageService
- Small refactoring of the test case to align more with testing style guide
Screenshots or screen recordings
In Npm::CreatePackageService
checks if the given user has the permission to create package. This authorization check was not done before as discussed in !125415 (comment 1462458380).
How to set up and validate locally
Just execute the following test
bundle exec rspec spec/services/packages/npm/create_package_service_spec.rb
TODOs
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR. -
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the javascript style guides -
Conforms to the database guides
-
Related to #418796
Edited by Gerardo Navarro