Sha256: fe351f95416ed865863522f9c07d47e0efc1fbeac9d9874c6168256c332c8156

Contents?: true

Size: 919 Bytes

Versions: 28

Compression:

Stored size: 919 Bytes

Contents

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

28 entries across 28 versions & 1 rubygems

Version Path
hyrax-2.3.3 app/presenters/hyrax/admin/users_presenter.rb
hyrax-2.3.2 app/presenters/hyrax/admin/users_presenter.rb
hyrax-2.3.1 app/presenters/hyrax/admin/users_presenter.rb
hyrax-2.3.0 app/presenters/hyrax/admin/users_presenter.rb
hyrax-2.2.4 app/presenters/hyrax/admin/users_presenter.rb
hyrax-2.2.3 app/presenters/hyrax/admin/users_presenter.rb
hyrax-2.2.2 app/presenters/hyrax/admin/users_presenter.rb
hyrax-2.2.1 app/presenters/hyrax/admin/users_presenter.rb