Sha256: 181a9fa7d59c36a305a521632b9b1a6edbcd6db2292f3083bbd2f2fb2253e635

Contents?: true

Size: 941 Bytes

Versions: 25

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module Admin
    class UsersPresenter
      # @return [Array] an array of Users
      def users
        @users ||= search
      end

      # @return [Number] quantity of users excluding the system users and guest_users
      def user_count
        users.count
      end

      # @return [Array] an array of user roles
      def user_roles(user)
        user.groups
      end

      def last_accessed(user)
        user.last_sign_in_at || user.created_at
      end

      # return [Boolean] true if the devise trackable module is enabled.
      def show_last_access?
        return @show_last_access unless @show_last_access.nil?
        @show_last_access = ::User.devise_modules.include?(:trackable)
      end

      private

      # Returns a list of users excluding the system users and guest_users
      def search
        ::User.registered.without_system_accounts
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hyrax-3.0.1 app/presenters/hyrax/admin/users_presenter.rb
hyrax-3.0.0 app/presenters/hyrax/admin/users_presenter.rb
hyrax-3.0.0.pre.rc4 app/presenters/hyrax/admin/users_presenter.rb
hyrax-3.0.0.pre.rc3 app/presenters/hyrax/admin/users_presenter.rb
hyrax-3.0.0.pre.rc2 app/presenters/hyrax/admin/users_presenter.rb