Sha256: c6d8e378c1bd06f0959e6d24a00dc70095363d62d563f30f815b6748daed5f90

Contents?: true

Size: 1.28 KB

Versions: 24

Compression:

Stored size: 1.28 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.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

24 entries across 24 versions & 1 rubygems

Version Path
osso-0.0.5.pre.epsilon lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.delta lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.gamma lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.beta lib/osso/models/enterprise_account.rb
osso-0.0.5.pre.alpha lib/osso/models/enterprise_account.rb
osso-0.0.4 lib/osso/models/enterprise_account.rb
osso-0.0.3.27 lib/osso/models/enterprise_account.rb
osso-0.0.3.26 lib/osso/models/enterprise_account.rb
osso-0.0.3.25 lib/osso/models/enterprise_account.rb
osso-0.0.3.24 lib/osso/models/enterprise_account.rb
osso-0.0.3.23 lib/osso/models/enterprise_account.rb
osso-0.0.3.22 lib/osso/models/enterprise_account.rb
osso-0.0.3.21 lib/osso/models/enterprise_account.rb
osso-0.0.3.20 lib/osso/models/enterprise_account.rb
osso-0.0.3.19 lib/osso/models/enterprise_account.rb
osso-0.0.3.18 lib/osso/models/enterprise_account.rb
osso-0.0.3.17 lib/osso/models/enterprise_account.rb
osso-0.0.3.16 lib/osso/models/enterprise_account.rb
osso-0.0.3.15 lib/osso/models/enterprise_account.rb
osso-0.0.3.14 lib/osso/models/enterprise_account.rb