2020-10-30 14:08:56 -04:00
---
2021-02-10 16:09:24 -05:00
stage: Fulfillment
2022-04-19 14:09:14 -04:00
group: Provision
2020-11-26 01:09:20 -05:00
info: 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
2020-10-30 14:08:56 -04:00
---
2021-03-01 01:10:47 -05:00
# Licensed feature availability
2019-05-05 09:57:21 -04:00
2019-07-08 23:28:41 -04:00
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
2019-05-05 09:57:21 -04:00
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
2019-07-08 23:28:41 -04:00
feature such as [Related issues ](../user/project/issues/related_issues.md ) or
2020-07-23 14:10:06 -04:00
[Service Desk ](../user/project/service_desk.md ),
2019-05-05 09:57:21 -04:00
it should be restricted on namespace scope.
2022-03-16 11:07:32 -04:00
1. Add the feature symbol on `STARTER_FEATURES` , `PREMIUM_FEATURES` , or `ULTIMATE_FEATURES` constants in
`ee/app/models/gitlab_subscriptions/features.rb` .
2019-07-18 22:20:32 -04:00
1. Check using:
2019-05-05 09:57:21 -04:00
```ruby
project.feature_available?(:feature_symbol)
```
## Restricting global features (instance)
2020-09-15 11:10:08 -04:00
However, for features such as [Geo ](../administration/geo/index.md ) and
2021-11-23 13:12:49 -05:00
[Database Load Balancing ](../administration/postgresql/database_load_balancing.md ), which cannot be restricted
2020-11-19 19:09:06 -05:00
to only a subset of projects or namespaces, the check is made directly in
2019-05-05 09:57:21 -04:00
the instance license.
2022-03-16 11:07:32 -04:00
1. Add the feature symbol to `STARTER_FEATURES` , `PREMIUM_FEATURES` or `ULTIMATE_FEATURES` constants in
`ee/app/models/gitlab_subscriptions/features.rb` .
2021-03-01 01:10:47 -05:00
1. Add the same feature symbol to `GLOBAL_FEATURES` .
2019-07-18 22:20:32 -04:00
1. Check using:
2019-05-05 09:57:21 -04:00
```ruby
License.feature_available?(:feature_symbol)
```
2021-04-13 14:11:28 -04:00
## Restricting frontend features
To restrict frontend features based on the license, use `push_licensed_feature` .
The frontend can then access this via `this.glFeatures` :
```ruby
before_action do
push_licensed_feature(:feature_symbol)
# or by project/namespace
push_licensed_feature(:feature_symbol, project)
end
```