Welcome to mirror list, hosted at ThFree Co, Russian Federation.

instance_policy.rb « clusters « policies « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f72096e8fc6e9fe6707ec040a3e1e7a5063589ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module Clusters
  class InstancePolicy < BasePolicy
    include ClusterableActions

    condition(:has_clusters, scope: :subject) { clusterable_has_clusters? }
    condition(:can_have_multiple_clusters) { multiple_clusters_available? }

    rule { admin }.policy do
      enable :read_cluster
      enable :add_cluster
      enable :create_cluster
      enable :update_cluster
      enable :admin_cluster
    end

    rule { ~can_have_multiple_clusters & has_clusters }.prevent :add_cluster
  end
end