app/models/concerns/spotlight/user.rb in blacklight-spotlight-3.0.0.rc3 vs app/models/concerns/spotlight/user.rb in blacklight-spotlight-3.0.0.rc4
- old
+ new
@@ -6,11 +6,10 @@
module User
extend ActiveSupport::Concern
included do
has_many :roles, class_name: 'Spotlight::Role', dependent: :destroy
has_many :exhibits, class_name: 'Spotlight::Exhibit', through: :roles, source: 'resource', source_type: 'Spotlight::Exhibit'
- has_many :reindexing_log_entries, class_name: 'Spotlight::ReindexingLogEntry'
scope :with_roles, -> { where(id: Spotlight::Role.distinct.pluck(:user_id)) }
before_create :add_default_roles
end
@@ -26,9 +25,11 @@
def admin_roles
exhibit_roles.where(role: 'admin')
end
def add_default_roles
+ return unless Spotlight::Engine.config.assign_default_roles_to_first_user
+
roles.build role: 'admin', resource: Spotlight::Site.instance unless self.class.any?
end
def invite_pending?
invited_to_sign_up? && !invitation_accepted?