diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2019-07-03 11:55:56 +0200 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2019-07-03 11:55:56 +0200 |
commit | c20c9e2940b0f94547246d05b7b526f0b1571027 (patch) | |
tree | c548960a37ab7447ff542e0844e838f973c118fb /app/policies | |
parent | 49d689fb3c7781c861f995aaafef4b224581020b (diff) | |
parent | 2ca9bda400c0ed647c3ef342dcc0aa56c558cebe (diff) | |
download | gitlab-ce-c20c9e2940b0f94547246d05b7b526f0b1571027.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/award_emoji_policy.rb | 11 | ||||
-rw-r--r-- | app/policies/clusters/instance_policy.rb | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/app/policies/award_emoji_policy.rb b/app/policies/award_emoji_policy.rb new file mode 100644 index 00000000000..21e382e24b3 --- /dev/null +++ b/app/policies/award_emoji_policy.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AwardEmojiPolicy < BasePolicy + delegate { @subject.awardable if DeclarativePolicy.has_policy?(@subject.awardable) } + + condition(:can_read_awardable) do + can?(:"read_#{@subject.awardable.to_ability_name}") + end + + rule { can_read_awardable }.enable :read_emoji +end diff --git a/app/policies/clusters/instance_policy.rb b/app/policies/clusters/instance_policy.rb index e1045c85e6d..f72096e8fc6 100644 --- a/app/policies/clusters/instance_policy.rb +++ b/app/policies/clusters/instance_policy.rb @@ -6,9 +6,8 @@ module Clusters condition(:has_clusters, scope: :subject) { clusterable_has_clusters? } condition(:can_have_multiple_clusters) { multiple_clusters_available? } - condition(:instance_clusters_enabled) { Instance.enabled? } - rule { admin & instance_clusters_enabled }.policy do + rule { admin }.policy do enable :read_cluster enable :add_cluster enable :create_cluster |