diff options
author | Robert Speicher <rspeicher@gmail.com> | 2018-09-21 15:43:24 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-10-04 14:08:21 -0500 |
commit | 939467885851eb0f3fc5bcbaab6cb585bb85710d (patch) | |
tree | 62b9b391f8d1a8c0bf9e3a780298ab2301e36a45 /app/models/project_feature.rb | |
parent | 1973d0c183218e7ca826d627eaea5ce91a17bed3 (diff) | |
download | gitlab-ce-939467885851eb0f3fc5bcbaab6cb585bb85710d.tar.gz |
Add ProjectFeature check for feature flag
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 4a0324e8b5c..754c2461d23 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -55,6 +55,9 @@ class ProjectFeature < ActiveRecord::Base default_value_for :repository_access_level, value: ENABLED, allows_nil: false 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 |