debian-mirror-gitlab/doc/development/licensed_feature_availability.md
2021-03-11 19:13:27 +05:30

1.6 KiB

stage group info
Fulfillment License To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments

Licensed feature availability (STARTER)

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.

  1. Add the feature symbol on EES_FEATURES, EEP_FEATURES or EEU_FEATURES constants in ee/app/models/license.rb. Note on ee/app/models/ee/namespace.rb that Bronze GitLab.com features maps to on-premise EES, Silver to EEP and Gold to EEU.
  2. 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 is made directly in the instance license.

  1. Add the feature symbol on EES_FEATURES, EEP_FEATURES or EEU_FEATURES constants in ee/app/models/license.rb.
  2. Add the same feature symbol to GLOBAL_FEATURES
  3. Check using:
License.feature_available?(:feature_symbol)