app/models/openstax/accounts/account.rb in openstax_accounts-8.0.0 vs app/models/openstax/accounts/account.rb in openstax_accounts-8.0.1
- old
+ new
@@ -1,10 +1,24 @@
module OpenStax::Accounts
class Account < ActiveRecord::Base
USERNAME_DISCARDED_CHAR_REGEX = /[^A-Za-z\d_]/
USERNAME_MAX_LENGTH = 50
+ SYNC_ATTRIBUTES = [
+ :username,
+ :first_name,
+ :last_name,
+ :full_name,
+ :title,
+ :self_reported_role,
+ :faculty_status,
+ :school_type,
+ :salesforce_contact_id,
+ :uuid,
+ :support_identifier,
+ :is_test
+ ]
attr_accessor :syncing
has_many :group_owners, dependent: :destroy,
class_name: 'OpenStax::Accounts::GroupOwner',
@@ -27,11 +41,12 @@
:instructor,
:administrator,
:librarian,
:designer,
:other,
- :adjunct
+ :adjunct,
+ :homeschool
]
enum school_type: [:unknown_school_type, :other_school_type, :college]
validates :faculty_status, :role, :school_type, presence: true
@@ -58,9 +73,17 @@
!access_token.nil?
end
def valid_openstax_uid?
!openstax_uid.nil? && openstax_uid > 0
+ end
+
+ def self_reported_role
+ role
+ end
+
+ def self_reported_role=(role)
+ self.role = role
end
protected
def syncing_or_stubbing?