module Bits
  class BadgePolicy < ApplicationPolicy
    def index?
      allowed?
    end

    def all?
      allowed?
    end

    def update_badge_tiers?
      allowed?
    end

    def moderate_badge_tiers?
      allowed?
    end

    def allowed?
      user.permitted?(BeefCake::Permission.for(:user_bits)) || user.permitted?(BeefCake::Permission.for(:moderate_bits_badges))
    end
  end
end
