summaryrefslogtreecommitdiff
path: root/app/policies/concerns
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-12-04 15:38:15 -0600
committerMayra Cabrera <mcabrera@gitlab.com>2018-12-24 10:28:40 -0600
commit01ed3a1511be5d2076b5f602839ca0046055dd8b (patch)
treee4f825cfb92c1a2fd470ac3fb3f50ededdeebbd2 /app/policies/concerns
parent4a10c813e726d09216c534bb0ad0ae50a0400259 (diff)
downloadgitlab-ce-01ed3a1511be5d2076b5f602839ca0046055dd8b.tar.gz
Allow users to add cluster with ancestors
Include a new policy in Clusterables (projects and groups), which checks if another cluster can be added clusterable_has_cluster? and multiple_clusters_available private methods will be overriden in EE Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/34758
Diffstat (limited to 'app/policies/concerns')
-rw-r--r--app/policies/concerns/clusterable_actions.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/policies/concerns/clusterable_actions.rb b/app/policies/concerns/clusterable_actions.rb
new file mode 100644
index 00000000000..08ddd742ea9
--- /dev/null
+++ b/app/policies/concerns/clusterable_actions.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module ClusterableActions
+ private
+
+ # Overridden on EE module
+ def multiple_clusters_available?
+ false
+ end
+
+ def clusterable_has_clusters?
+ !subject.clusters.empty?
+ end
+end