debian-mirror-gitlab/app/policies/achievements/user_achievement_policy.rb
2023-06-20 00:43:36 +05:30

12 lines
351 B
Ruby

# frozen_string_literal: true
module Achievements
class UserAchievementPolicy < ::BasePolicy
delegate { @subject.achievement.namespace }
delegate { @subject.user }
rule { can?(:read_user_profile) | can?(:admin_achievement) }.enable :read_user_achievement
rule { ~can?(:read_achievement) }.prevent :read_user_achievement
end
end