lib/osso/models/enterprise_account.rb in osso-0.0.5.pre.zeta vs lib/osso/models/enterprise_account.rb in osso-0.0.5
- old
+ new
@@ -6,14 +6,15 @@
# 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
+ validates_format_of :domain, with: /\A[a-z0-9]+([\-.]{1}[a-z0-9]+)*\.[a-z]{2,5}\z/
+
def single_provider?
identity_providers.not_pending.one?
end
def provider
@@ -38,9 +39,10 @@
# external_id :string
# oauth_client_id :uuid
# name :string not null
# created_at :datetime not null
# updated_at :datetime not null
+# users_count :integer default(0)
#
# Indexes
#
# index_enterprise_accounts_on_domain (domain) UNIQUE
# index_enterprise_accounts_on_oauth_client_id (oauth_client_id)