app/models/concerns/spotlight/user.rb in blacklight-spotlight-0.22.0 vs app/models/concerns/spotlight/user.rb in blacklight-spotlight-0.23.0
- old
+ new
@@ -5,9 +5,11 @@
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'
+ scope :with_roles, -> { where(id: Spotlight::Role.uniq.pluck(:user_id)) }
+
before_create :add_default_roles
end
def superadmin?
roles.where(role: 'admin', resource: Spotlight::Site.instance).any?