Class: Munificent::Admin::User
- Inherits:
-
Munificent::ApplicationRecord
- Object
- Munificent::ApplicationRecord
- Munificent::Admin::User
- Includes:
- Authenticable
- Defined in:
- app/models/munificent/admin/user.rb
Instance Attribute Summary collapse
-
#password_confirmation ⇒ Object
Returns the value of attribute password_confirmation.
-
#require_password ⇒ Object
writeonly
Sets the attribute require_password.
Instance Method Summary collapse
-
#active? ⇒ Boolean
We may use these later, but for now default them to ‘true`.
- #approved? ⇒ Boolean
- #confirmed? ⇒ Boolean
- #has_2sv? ⇒ Boolean
- #permissions ⇒ Object
- #require_password? ⇒ Boolean
- #states ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#password_confirmation ⇒ Object
Returns the value of attribute password_confirmation.
6 7 8 |
# File 'app/models/munificent/admin/user.rb', line 6 def password_confirmation @password_confirmation end |
#require_password=(value) ⇒ Object (writeonly)
Sets the attribute require_password
7 8 9 |
# File 'app/models/munificent/admin/user.rb', line 7 def require_password=(value) @require_password = value end |
Instance Method Details
#active? ⇒ Boolean
We may use these later, but for now default them to ‘true`.
45 |
# File 'app/models/munificent/admin/user.rb', line 45 def active? = true |
#approved? ⇒ Boolean
46 |
# File 'app/models/munificent/admin/user.rb', line 46 def approved? = true |
#confirmed? ⇒ Boolean
47 |
# File 'app/models/munificent/admin/user.rb', line 47 def confirmed? = true |
#has_2sv? ⇒ Boolean
20 21 22 |
# File 'app/models/munificent/admin/user.rb', line 20 def has_2sv? otp_secret.present? end |
#permissions ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/munificent/admin/user.rb', line 24 def if full_access? ["full access"] else [].tap do |perms| perms << "data entry" if data_entry? perms << "manages users" if manages_users? perms << "support" if support? end end end |
#require_password? ⇒ Boolean
9 10 11 |
# File 'app/models/munificent/admin/user.rb', line 9 def require_password? !!@require_password end |
#states ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/models/munificent/admin/user.rb', line 36 def states [].tap do |states| states << "active" if active? states << "approved" if approved? states << "confirmed" if confirmed? end end |
#to_s ⇒ Object
49 50 51 |
# File 'app/models/munificent/admin/user.rb', line 49 def to_s name.presence || email_address end |