BigW Consortium Gitlab

identity.rb 563 Bytes
Newer Older
Dmitriy Zaporozhets committed
1 2 3 4 5 6 7 8
# == Schema Information
#
# Table name: identities
#
#  id         :integer          not null, primary key
#  extern_uid :string(255)
#  provider   :string(255)
#  user_id    :integer
9 10
#  created_at :datetime
#  updated_at :datetime
Dmitriy Zaporozhets committed
11 12
#

13
class Identity < ActiveRecord::Base
14
  include Sortable
15
  include CaseSensitivity
16 17
  belongs_to :user

18
  validates :provider, presence: true
19
  validates :extern_uid, allow_blank: true, uniqueness: { scope: :provider }
Valery Sizov committed
20
  validates :user_id, uniqueness: { scope: :provider }
21

Gabriel Mazetto committed
22
  def ldap?
23 24
    provider.starts_with?('ldap')
  end
Dmitriy Zaporozhets committed
25
end