gitlab-org--gitlab-foss/lib/gitlab/rack_attack/user_allowlist.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
490 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'set'
module Gitlab
module RackAttack
class UserAllowlist
extend Forwardable
def_delegators :@set, :empty?, :include?, :to_a
def initialize(list)
@set = Set.new
list.to_s.split(',').each do |id|
@set << Integer(id) unless id.blank?
rescue ArgumentError
Gitlab::AuthLogger.error(message: 'ignoring invalid user allowlist entry', entry: id)
end
end
end
end
end