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
onFEATURE_CODES
Hash - that is onLicense
- Add
NEW_FEATURE => 1
onEE*_FEATURES
Hash - also onLicense
(to mimic the legacy pattern we used to fetch onLicense#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.
can?
method pattern
Follow 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 by Oswaldo Ferreira