diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/models/project_feature.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/models/project_feature.rb')
-rw-r--r-- | app/models/project_feature.rb | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/app/models/project_feature.rb b/app/models/project_feature.rb index 0d3e50837ab..33783d31355 100644 --- a/app/models/project_feature.rb +++ b/app/models/project_feature.rb @@ -3,6 +3,7 @@ class ProjectFeature < ApplicationRecord include Featurable extend Gitlab::ConfigHelper + extend ::Gitlab::Utils::Override # When updating this array, make sure to update rubocop/cop/gitlab/feature_available_usage.rb as well. FEATURES = %i[ @@ -155,31 +156,14 @@ class ProjectFeature < ApplicationRecord %i(merge_requests_access_level builds_access_level).each(&validator) end - def get_permission(user, feature) - case access_level(feature) - when DISABLED - false - when PRIVATE - team_access?(user, feature) - when ENABLED - true - when PUBLIC - true - else - true - end + def feature_validation_exclusion + %i(pages) end - def team_access?(user, feature) - return unless user - return true if user.can_read_all_resources? - + override :resource_member? + def resource_member?(user, feature) project.team.member?(user, ProjectFeature.required_minimum_access_level(feature)) end - - def feature_validation_exclusion - %i(pages) - end end ProjectFeature.prepend_mod_with('ProjectFeature') |