Class: Kryptonite::User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Kryptonite::User
- Defined in:
- app/models/kryptonite/user.rb
Instance Attribute Summary collapse
-
#notify_of_new_password ⇒ Object
Returns the value of attribute notify_of_new_password.
Class Method Summary collapse
Instance Method Summary collapse
- #check_time_zone ⇒ Object
- #is_admin? ⇒ Boolean
- #is_user? ⇒ Boolean
- #send_create_notification ⇒ Object
- #send_password_reset_instructions ⇒ Object
- #send_update_notification ⇒ Object
Instance Attribute Details
#notify_of_new_password ⇒ Object
Returns the value of attribute notify_of_new_password.
16 17 18 |
# File 'app/models/kryptonite/user.rb', line 16 def notify_of_new_password @notify_of_new_password end |
Class Method Details
.has_more_than_one_admin ⇒ Object
29 30 31 |
# File 'app/models/kryptonite/user.rb', line 29 def self.has_more_than_one_admin Kryptonite::User.where(:access_level => $KRYPTONITE_USER_ACCESS_LEVEL_ADMIN).count > 1 end |
.table_name ⇒ Object
10 11 12 |
# File 'app/models/kryptonite/user.rb', line 10 def self.table_name self.to_s.gsub("::", "_").tableize end |
Instance Method Details
#check_time_zone ⇒ Object
49 50 51 |
# File 'app/models/kryptonite/user.rb', line 49 def check_time_zone self.time_zone = Rails.configuration.time_zone unless self.time_zone end |
#is_admin? ⇒ Boolean
53 54 55 |
# File 'app/models/kryptonite/user.rb', line 53 def is_admin? access_level == $KRYPTONITE_USER_ACCESS_LEVEL_ADMIN end |
#is_user? ⇒ Boolean
57 58 59 |
# File 'app/models/kryptonite/user.rb', line 57 def is_user? access_level == $KRYPTONITE_USER_ACCESS_LEVEL_USER end |
#send_create_notification ⇒ Object
33 34 35 |
# File 'app/models/kryptonite/user.rb', line 33 def send_create_notification Kryptonite::KryptoniteNotification.new_user_information(kryptonite_config_email_from_address, self, kryptonite_config_hostname, @password).deliver end |
#send_password_reset_instructions ⇒ Object
44 45 46 47 |
# File 'app/models/kryptonite/user.rb', line 44 def send_password_reset_instructions reset_perishable_token! Kryptonite::KryptoniteNotification.password_reset_instructions(kryptonite_config_email_from_address, self, kryptonite_config_hostname).deliver end |
#send_update_notification ⇒ Object
37 38 39 40 41 42 |
# File 'app/models/kryptonite/user.rb', line 37 def send_update_notification if notify_of_new_password notify_of_new_password = false Kryptonite::KryptoniteNotification.generate_new_password(kryptonite_config_email_from_address, self, kryptonite_config_hostname, @password).deliver end end |