gitlab-org--gitlab-foss/app/policies/award_emoji_policy.rb
Luke Duncalfe 4b9b2a43d0 GraphQL mutations for add, remove and toggle emoji
Adding new `AddAwardEmoji`, `RemoveAwardEmoji` and `ToggleAwardEmoji`
GraphQL mutations.

Adding new `#authorized_find_with_pre_checks!` and (unused, but for
completeness `#authorized_find_with_post_checks!`) authorization
methods. These allow us to perform an authorized find, and run our own
additional checks before or after the authorization runs.

https://gitlab.com/gitlab-org/gitlab-ce/issues/62826
2019-06-28 12:03:33 +12:00

11 lines
307 B
Ruby

# 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