Sha256: a78542697be66f7ee19df67fdf74b6c67a52aa4e72bf3d8f8518873f7676225b

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Osso
  module Models
    # Base class for Enterprises. This should map one-to-one with
    # your own Account model. Persisting the EnterpriseAccount id
    # in your application's database is recommended. The table also
    # includes fields for external IDs such that you can persist
    # your ID for an account in your Osso instance.
    class EnterpriseAccount < ActiveRecord::Base
      belongs_to :oauth_client
      has_many :users
      has_many :identity_providers

      def single_provider?
        identity_providers.not_pending.one?
      end

      def provider
        return nil unless single_provider?

        identity_providers.first
      end

      alias identity_provider provider
    end
  end
end

# == Schema Information
#
# Table name: enterprise_accounts
#
#  id              :uuid             not null, primary key
#  domain          :string           not null
#  external_uuid   :uuid
#  external_int_id :integer
#  external_id     :string
#  oauth_client_id :uuid
#  name            :string           not null
#  created_at      :datetime         not null
#  updated_at      :datetime         not null
#
# Indexes
#
#  index_enterprise_accounts_on_domain           (domain) UNIQUE
#  index_enterprise_accounts_on_oauth_client_id  (oauth_client_id)
#

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
osso-0.0.5.pre.lambda lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.kappa lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.iota lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.theta lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.eta lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.zeta lib/osso/models/enterprise_account.rb