diff options
author | Robert Speicher <rspeicher@gmail.com> | 2018-09-21 15:43:24 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-09-21 15:43:24 -0500 |
commit | 44f6e171e8fa4785bf1790e09871809480da22fb (patch) | |
tree | 9a90c573a8728839f4e8f0be970f123251b2a202 /app/models/project_feature.rb | |
parent | a9aa98a23a7f52b4c0dbe48793ac3ed0b1f6d609 (diff) | |
download | gitlab-ce-rs-feature-enabled-and-licensed.tar.gz |
Add ProjectFeature check for feature flagrs-feature-enabled-and-licensed
This will allow an explicitly-disabled feature flag to override a
feature being available for a project.
As an extreme example, we could quickly disable issues across all
projects at runtime by running `Feature.disable(:issues)`.
Diffstat (limited to 'app/models/project_feature.rb')
-rw-r--r-- | app/models/project_feature.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index d74cb2506ba..346db2847d8 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -59,6 +59,9 @@ class ProjectFeature < ActiveRecord::Base after_update :update_site_statistics def feature_available?(feature, user) + # This feature might not be behind a feature flag at all, so default to true + return false unless ::Feature.enabled?(feature, user, default_enabled: true) + get_permission(user, access_level(feature)) end |