summaryrefslogtreecommitdiff
path: root/app/models/project_feature.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project_feature.rb')
-rw-r--r--app/models/project_feature.rb26
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')