Allow feature flags to be set per user, or for predefined Flipper groups

In #33929, we're discussing the need to be able to enable the performance bar for a given group of people.

More generally, it can be useful (and probably needed) to be able to enable a feature for:

The idea is that you'll be able to check if a feature is enabled for the current_user, e.g. Feature.enabled?(:gitlab_performance_bar, current_user).

Then, you'll be able to activate the feature for:

  • a given user, e.g. POST /api/v4/features/gitlab_performance_bar with a user=rymai body
  • a Flipper group, e.g. POST /api/v4/features/gitlab_performance_bar with a flipper_group=performance_team
    • this requires the Flipper group to be registered beforehand in config/initializers/flipper.rb:

      Flipper.register(:performance_team) do |actor|
        Gitlab::PerformanceBar.allowed_actor?(actor)
      end

I'm going (actually, I already did) to implement that since we need it for the performance bar.

/cc @stanhu @eReGeBe

Edited by Rémy Coutable