summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2019-02-19 07:50:55 +0000
committerJames Lopez <james@gitlab.com>2019-02-19 07:50:55 +0000
commit5ff775fdef99eeec1f25bea7baf5480fa402f714 (patch)
treed7f9b148101af6690214989fa33d0bcd0cf301e9 /lib
parent503061217e010e74d155464be7dfd8e9754776db (diff)
parent46f66c7f0aa5ddf2f8d996880936d88e6977f6c0 (diff)
downloadgitlab-ce-5ff775fdef99eeec1f25bea7baf5480fa402f714.tar.gz
Merge branch 'jej/feature-gates-can-be-set-by-group-path' into 'master'
Allow setting feature flags per GitLab group See merge request gitlab-org/gitlab-ce!25022
Diffstat (limited to 'lib')
-rw-r--r--lib/api/features.rb1
-rw-r--r--lib/feature.rb10
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/api/features.rb b/lib/api/features.rb
index 835aac05905..4dc1834c644 100644
--- a/lib/api/features.rb
+++ b/lib/api/features.rb
@@ -42,6 +42,7 @@ module API
requires :value, type: String, desc: '`true` or `false` to enable/disable, an integer for percentage of time'
optional :feature_group, type: String, desc: 'A Feature group name'
optional :user, type: String, desc: 'A GitLab username'
+ optional :group, type: String, desc: "A GitLab group's path, such as 'gitlab-org'"
optional :project, type: String, desc: 'A projects path, like gitlab-org/gitlab-ce'
end
post ':name' do
diff --git a/lib/feature.rb b/lib/feature.rb
index e59cd70f822..749c861d740 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -111,11 +111,11 @@ class Feature
end
def gate_specified?
- %i(user project feature_group).any? { |key| params.key?(key) }
+ %i(user project group feature_group).any? { |key| params.key?(key) }
end
def targets
- [feature_group, user, project].compact
+ [feature_group, user, project, group].compact
end
private
@@ -139,5 +139,11 @@ class Feature
Project.find_by_full_path(params[:project])
end
+
+ def group
+ return unless params.key?(:group)
+
+ Group.find_by_full_path(params[:group])
+ end
end
end