Namespace plan check follow-up - facilitate feature addition

As a follow-up for https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1961, we should make the following improvements:

One should not have to change more than one place to map a new feature for a plan

Today, to map a new feature, one should:

  • Create a feature constant
  • Add feature: NEW_FEATURE on FEATURE_CODES Hash - that is on License
  • Add NEW_FEATURE => 1 on EE*_FEATURES Hash - also on License (to mimic the legacy pattern we used to fetch on License#add_ons)

Ultimately, we should be able to map those features in a way that only a new Symbol addition on a plan list would be enough.

Follow can? method pattern

One should be able to call can?(user, :feature, project) (wrapping Project#feature_available?) in order to stay consistent with the rest of the permission checking.

cc @DouweM

Edited May 22, 2017 by Oswaldo Ferreira
Assignee Loading
Time tracking Loading