Add `gitlab_team_members` feature group
What does this MR do and why?
Describe in detail what your merge request does and why.
Allow user-based feature flags to be enabled for all GitLab team members by using a feature group. The flag can then be enabled via the API with:
POST /api/v4/features/:name
value=true&feature_group=gitlab_team_members
Before this can be used with GitLab.com chatops, the flags need to be updated to support the feature_group
parameter.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Manually edit
GITLAB_COM_GROUP_ID
to the id of the group that you would like to test with -
Create a PAT.
-
Create a test feature flag:
bin/feature-flag test
(Press enter on all prompts) -
Enable the flag:
curl -d 'value=true&feature_group=gitlab_team_members' -H "PRIVATE_TOKEN: $GITLAB_TOKEN" http://gdk.local:3000/api/v4/features/test
-
Start the rails console:
bundle exec rails c
-
Check that the feature is enabled for all members of the group:
ENV['GITLAB_SIMULATE_SAAS'] = '1' group = Group.find(31) group.members.map { |member| Feature.enabled?(:test, member.user) }
-
Check the feature is not enabled for non-members:
non_member = User.id_not_in(group.members.pluck_user_ids).first Feature.enabled?(:test, non_member)
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.