Skip to content

Add more verification for namespace UserCap availability

Vijay Hawoldar requested to merge vij-user-cap-restrictions into master

What does this MR do and why?

Adds a method to ensure the SaaS User Cap feature is only available for:

  • Gitlab.com environment
  • groups that have the feature flag specifically enabled for them

Also changes some instances of the Feature.enabled?(:saas_user_caps) to use the newly added method

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Find or create a group
  2. Enable feature flag for the group
    Feature.enable(:saas_user_caps, group)
  3. Check method:
    group.user_cap_available?
    
    => false
  4. Modify Gitlab.com? to return true
  5. Re-check the method:
    group.user_cap_available?
    
    => true
  6. Disable the feature flag
    Feature.disable(:saas_user_caps, group)
  7. Re-check the method:
    group.user_cap_available?
    
    => false

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 Vijay Hawoldar

Merge request reports