summaryrefslogtreecommitdiff
path: root/doc/development/licensed_feature_availability.md
blob: 1657d73e0c938e3fe10f8c58b814cc5c5221e730 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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](https://docs.gitlab.com/ee/user/project/issues/related_issues.html) or 
[Service desk](https://docs.gitlab.com/ee/user/project/service_desk.html), 
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:

```ruby
project.feature_available?(:feature_symbol)
```

## Restricting global features (instance)

However, for features such as [Geo](https://docs.gitlab.com/ee/administration/geo/replication/index.html) and 
[Load balancing](https://docs.gitlab.com/ee/administration/database_load_balancing.html), which cannot be restricted 
to only a subset of projects or namespaces, the check will be 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:

```ruby
License.feature_available?(:feature_symbol)
```