Protected packages: Align logic for protection rules across registries
requested to merge gitlab-community/gitlab:416382-gerardo-navarro-protected-packages-align-scope-method-from-container-registry into master
What does this MR do and why?
- This MR intends to keep the code and implementation consistent across the container and the package registry; this means, we want to apply improvements from the implementation of the protected containers, see related MRs
- Renaming the scope method
.push_protected_from?
to.for_push_exists?
in order to be alinged with the scope method used inapp/models/container_registry/protection/rule.rb
- Adjust return value of scope method to reflect the same logic as in
app/models/container_registry/protection/rule.rb
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
MR Checklist (@gerardo-navarro)
-
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
Screenshots or screen recordings
Only backend changes
How to set up and validate locally
- Execute the relevant tests
bundle exec rspec spec/models/packages/protection/rule_spec.rb spec/services/packages/npm/create_package_service_spec.rb
Related to #416382
💾 Database review
Edited by Gerardo Navarro