Skip to content

Added read_usage_quotas ability to ProjectPolicy

Suraj Tripathi requested to merge issue_338706_add_read_usage_quota into master

What does this MR do and why?

Closes: https://gitlab.com/gitlab-org/gitlab/-/issues/338706

Added a new ability in the ProjectPolicy for allowing access to read_usage_report, this change was suggested as part of !68289 (comment 652353799). The initial change was behind a feature flag, but the current production change does not have any feature flag, so for now the ability is similar to :admin_poject

What do you think of adding a read_usage_quotas permission to ProjectPolicy to use here? Or potentially adding it in a follow up MR? I can definitely foresee a product-need to have a unique permissions for viewing/managing usage quotas, separate from admin_project. Using admin_project is a fine first step, but it's always easier to start with separate permissions for a feature and combine them if needed, rather than to break apart permissions later on after the feature has grown to have many tendrils.

Screenshots or screen recordings

Screenshot_2022-03-09_at_4.51.39_PM

How to set up and validate locally

  1. Create a project and navigate to <project_owner_user_name>/<project-name>/-/usage_quotas, you should be able to see project details like the above screenshot. Alternatively you can also try to navigate by going to the Project > Settings > Usage Quotas, but you wont see "Settings" if you are not the owner or maintainer of the project
  2. Test with new user having guest, report, developer role to the project, the same path should show 404
  3. Test with new user having owner, maintainer role to the project, you should be able to see project details like the above screenshot

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Suraj Tripathi

Merge request reports