1--- 2stage: Fulfillment 3group: License 4info: 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 5--- 6 7# Licensed feature availability 8 9As of GitLab 9.4, we've been supporting a simplified version of licensed 10feature availability checks via `ee/app/models/license.rb`, both for 11on-premise or GitLab.com plans and features. 12 13## Restricting features scoped by namespaces or projects 14 15GitLab.com plans are persisted on user groups and namespaces, therefore, if you're adding a 16feature such as [Related issues](../user/project/issues/related_issues.md) or 17[Service Desk](../user/project/service_desk.md), 18it should be restricted on namespace scope. 19 201. Add the feature symbol on `EES_FEATURES`, `EEP_FEATURES`, or `EEU_FEATURES` constants in 21 `ee/app/models/license.rb`. Note that the prefix `EES` signifies Starter, `EEP` signifies 22 Premium, and `EEU` signifies Ultimate. 231. Check using: 24 25```ruby 26project.feature_available?(:feature_symbol) 27``` 28 29## Restricting global features (instance) 30 31However, for features such as [Geo](../administration/geo/index.md) and 32[Database Load Balancing](../administration/postgresql/database_load_balancing.md), which cannot be restricted 33to only a subset of projects or namespaces, the check is made directly in 34the instance license. 35 361. Add the feature symbol on `EES_FEATURES`, `EEP_FEATURES` or `EEU_FEATURES` constants in 37 `ee/app/models/license.rb`. 381. Add the same feature symbol to `GLOBAL_FEATURES`. 391. Check using: 40 41```ruby 42License.feature_available?(:feature_symbol) 43``` 44 45## Restricting frontend features 46 47To restrict frontend features based on the license, use `push_licensed_feature`. 48The frontend can then access this via `this.glFeatures`: 49 50```ruby 51before_action do 52 push_licensed_feature(:feature_symbol) 53 # or by project/namespace 54 push_licensed_feature(:feature_symbol, project) 55end 56``` 57