blob: ac6e08caf50261831cdbe571e75f1f2a37c03d4a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
class AuthenticationEvent < ApplicationRecord
include UsageStatistics
belongs_to :user, optional: true
validates :provider, :user_name, :result, presence: true
validates :ip_address, ip_address: true
enum result: {
failed: 0,
success: 1
}
scope :for_provider, ->(provider) { where(provider: provider) }
scope :ldap, -> { where('provider LIKE ?', 'ldap%')}
def self.providers
distinct.pluck(:provider)
end
end
|