debian-mirror-gitlab/doc/development/licensed_feature_availability.md

44 lines
1.6 KiB
Markdown
Raw Normal View History

2021-01-29 00:20:46 +05:30
---
stage: none
group: unassigned
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/#designated-technical-writers
---
2019-09-30 21:07:59 +05:30
# Licensed feature availability **(STARTER)**
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
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-07-31 22:56:46 +05:30
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-09-30 21:07:59 +05:30
feature such as [Related issues](../user/project/issues/related_issues.md) or
2020-10-24 23:57:45 +05:30
[Service Desk](../user/project/service_desk.md),
2019-07-31 22:56:46 +05:30
it should be restricted on namespace scope.
2019-09-30 21:07:59 +05:30
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-07-31 22:56:46 +05:30
features maps to on-premise _EES_, _Silver_ to _EEP_ and _Gold_ to _EEU_.
2019-10-12 21:52:04 +05:30
1. Check using:
2019-07-31 22:56:46 +05:30
```ruby
project.feature_available?(:feature_symbol)
```
## Restricting global features (instance)
2020-11-24 15:15:51 +05:30
However, for features such as [Geo](../administration/geo/index.md) and
2019-09-30 21:07:59 +05:30
[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-07-31 22:56:46 +05:30
the instance license.
2019-09-30 21:07:59 +05:30
1. Add the feature symbol on `EES_FEATURES`, `EEP_FEATURES` or `EEU_FEATURES` constants in
2019-07-31 22:56:46 +05:30
`ee/app/models/license.rb`.
2019-10-12 21:52:04 +05:30
1. Add the same feature symbol to `GLOBAL_FEATURES`
1. Check using:
2019-07-31 22:56:46 +05:30
```ruby
License.feature_available?(:feature_symbol)
```