2019-07-08 08:50:38 +00:00
|
|
|
# Licensed feature availability **(STARTER)**
|
2019-05-05 13:57:21 +00:00
|
|
|
|
2019-07-09 03:28:41 +00: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 13:57:21 +00: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-09 03:28:41 +00:00
|
|
|
feature such as [Related issues](../user/project/issues/related_issues.md) or
|
2020-07-23 18:10:06 +00:00
|
|
|
[Service Desk](../user/project/service_desk.md),
|
2019-05-05 13:57:21 +00:00
|
|
|
it should be restricted on namespace scope.
|
|
|
|
|
2019-07-09 03:28:41 +00:00
|
|
|
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
|
2019-05-05 13:57:21 +00:00
|
|
|
features maps to on-premise _EES_, _Silver_ to _EEP_ and _Gold_ to _EEU_.
|
2019-07-19 02:20:32 +00:00
|
|
|
1. Check using:
|
2019-05-05 13:57:21 +00:00
|
|
|
|
|
|
|
```ruby
|
|
|
|
project.feature_available?(:feature_symbol)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Restricting global features (instance)
|
|
|
|
|
2020-09-15 15:10:08 +00:00
|
|
|
However, for features such as [Geo](../administration/geo/index.md) and
|
2019-07-09 03:28:41 +00:00
|
|
|
[Load balancing](../administration/database_load_balancing.md), which cannot be restricted
|
|
|
|
to only a subset of projects or namespaces, the check will be made directly in
|
2019-05-05 13:57:21 +00:00
|
|
|
the instance license.
|
|
|
|
|
2019-07-09 03:28:41 +00:00
|
|
|
1. Add the feature symbol on `EES_FEATURES`, `EEP_FEATURES` or `EEU_FEATURES` constants in
|
2019-05-05 13:57:21 +00:00
|
|
|
`ee/app/models/license.rb`.
|
2019-07-19 02:20:32 +00:00
|
|
|
1. Add the same feature symbol to `GLOBAL_FEATURES`
|
|
|
|
1. Check using:
|
2019-05-05 13:57:21 +00:00
|
|
|
|
|
|
|
```ruby
|
|
|
|
License.feature_available?(:feature_symbol)
|
|
|
|
```
|