summaryrefslogtreecommitdiff
path: root/app/presenters/clusterable_presenter.rb
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/presenters/clusterable_presenter.rb
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/presenters/clusterable_presenter.rb')
-rw-r--r--app/presenters/clusterable_presenter.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/presenters/clusterable_presenter.rb b/app/presenters/clusterable_presenter.rb
index 9cc137aa3bd..d94d9118eee 100644
--- a/app/presenters/clusterable_presenter.rb
+++ b/app/presenters/clusterable_presenter.rb
@@ -12,6 +12,10 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
.fabricate!
end
+ def can_add_cluster?
+ can?(current_user, :add_cluster, clusterable)
+ end
+
def can_create_cluster?
can?(current_user, :create_cluster, clusterable)
end