Licensed feature availability
As of GitLab 9.4, we've been supporting a simplified version of licensed
feature availability checks via ee/app/models/license.rb, both for
on-premise or GitLab.com plans and features.
Restricting features scoped by namespaces or projects
GitLab.com plans are persisted on user groups and namespaces, therefore, if you're adding a feature such as Related issues or Service desk, it should be restricted on namespace scope.
- Add the feature symbol on
EES_FEATURES,EEP_FEATURESorEEU_FEATURESconstants inee/app/models/license.rb. Note onee/app/models/ee/namespace.rbthat Bronze GitLab.com features maps to on-premise EES, Silver to EEP and Gold to EEU. - Check using:
project.feature_available?(:feature_symbol)
Restricting global features (instance)
However, for features such as Geo and Load balancing, which cannot be restricted to only a subset of projects or namespaces, the check will be made directly in the instance license.
- Add the feature symbol on
EES_FEATURES,EEP_FEATURESorEEU_FEATURESconstants inee/app/models/license.rb. - Add the same feature symbol to
GLOBAL_FEATURES - Check using:
License.feature_available?(:feature_symbol)