Class: Hyrax::Admin::UsersPresenter
- Inherits:
-
Object
- Object
- Hyrax::Admin::UsersPresenter
- Defined in:
- app/presenters/hyrax/admin/users_presenter.rb
Instance Method Summary collapse
- #last_accessed(user) ⇒ Object
-
#show_last_access? ⇒ Boolean
return [Boolean] true if the devise trackable module is enabled.
-
#user_count ⇒ Number
Quantity of users excluding the system users and guest_users.
-
#user_roles(user) ⇒ Array
An array of user roles.
-
#users ⇒ Array
An array of Users.
Instance Method Details
#last_accessed(user) ⇒ Object
19 20 21 |
# File 'app/presenters/hyrax/admin/users_presenter.rb', line 19 def last_accessed(user) user.last_sign_in_at || user.created_at end |
#show_last_access? ⇒ Boolean
return [Boolean] true if the devise trackable module is enabled.
24 25 26 27 |
# File 'app/presenters/hyrax/admin/users_presenter.rb', line 24 def show_last_access? return @show_last_access unless @show_last_access.nil? @show_last_access = ::User.devise_modules.include?(:trackable) end |
#user_count ⇒ Number
Returns quantity of users excluding the system users and guest_users.
10 11 12 |
# File 'app/presenters/hyrax/admin/users_presenter.rb', line 10 def user_count users.count end |
#user_roles(user) ⇒ Array
Returns an array of user roles.
15 16 17 |
# File 'app/presenters/hyrax/admin/users_presenter.rb', line 15 def user_roles(user) user.groups end |
#users ⇒ Array
Returns an array of Users.
5 6 7 |
# File 'app/presenters/hyrax/admin/users_presenter.rb', line 5 def users @users ||= search end |