Sha256: e7c824af9c3f228b5a5b6fd9ebf8e7288f72b49ec85259598704244991716972

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Osso
  module Models
    class User < ActiveRecord::Base
      belongs_to :enterprise_account, counter_cache: true
      belongs_to :identity_provider, counter_cache: true
      has_many :authorization_codes, dependent: :delete_all
      has_many :access_tokens, dependent: :delete_all

      def oauth_client
        identity_provider.oauth_client
      end

      def as_json(*)
        {
          email: email,
          id: id,
          idp: identity_provider.name,
        }
      end
    end
  end
end

# == Schema Information
#
# Table name: users
#
#  id                    :uuid             not null, primary key
#  email                 :string           not null
#  idp_id                :string           not null
#  identity_provider_id  :uuid
#  enterprise_account_id :uuid
#  created_at            :datetime         not null
#  updated_at            :datetime         not null
#
# Indexes
#
#  index_users_on_email_and_idp_id       (email,idp_id) UNIQUE
#  index_users_on_enterprise_account_id  (enterprise_account_id)
#
# Foreign Keys
#
#  fk_rails_...  (identity_provider_id => identity_providers.id)
#

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
osso-0.1.2 lib/osso/models/user.rb
osso-0.1.1 lib/osso/models/user.rb
osso-0.1.0 lib/osso/models/user.rb
osso-0.0.11 lib/osso/models/user.rb
osso-0.0.10 lib/osso/models/user.rb
osso-0.0.8 lib/osso/models/user.rb
osso-0.0.7 lib/osso/models/user.rb
osso-0.0.6 lib/osso/models/user.rb
osso-0.0.6.alpha lib/osso/models/user.rb
osso-0.0.5 lib/osso/models/user.rb
osso-0.0.5.pre.lambda lib/osso/models/user.rb
osso-0.0.5.pre.kappa lib/osso/models/user.rb