diff options
author | James Fargher <proglottis@gmail.com> | 2019-05-02 13:07:38 +1200 |
---|---|---|
committer | James Fargher <proglottis@gmail.com> | 2019-05-07 08:37:04 +1200 |
commit | beb66cfcba26d0796644ccce2dfac8c65a808144 (patch) | |
tree | 6bb32fccb64f91776e946d84c5717d1ae52a9d7e /app/policies | |
parent | 8db382b05545fdef0a60bcff65f8c23e8b1ed282 (diff) | |
download | gitlab-ce-beb66cfcba26d0796644ccce2dfac8c65a808144.tar.gz |
Check instance cluster feature at policy level
Try to simplify feature flag checks by using policies
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/clusters/instance_policy.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/policies/clusters/instance_policy.rb b/app/policies/clusters/instance_policy.rb index f72096e8fc6..0818a5b2604 100644 --- a/app/policies/clusters/instance_policy.rb +++ b/app/policies/clusters/instance_policy.rb @@ -6,8 +6,9 @@ module Clusters condition(:has_clusters, scope: :subject) { clusterable_has_clusters? } condition(:can_have_multiple_clusters) { multiple_clusters_available? } + condition(:instance_clusters_enabled, scope: :subject) { @subject.instance_clusters_enabled? } - rule { admin }.policy do + rule { admin & instance_clusters_enabled }.policy do enable :read_cluster enable :add_cluster enable :create_cluster |