Class: Kryptonite::User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/kryptonite/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#notify_of_new_passwordObject

Returns the value of attribute notify_of_new_password.



15
16
17
# File 'app/models/kryptonite/user.rb', line 15

def notify_of_new_password
  @notify_of_new_password
end

Class Method Details

.has_more_than_one_adminObject



28
29
30
# File 'app/models/kryptonite/user.rb', line 28

def self.has_more_than_one_admin
  Kryptonite::User.where(:access_level => $KRYPTONITE_USER_ACCESS_LEVEL_ADMIN).count > 1
end

.table_nameObject



9
10
11
# File 'app/models/kryptonite/user.rb', line 9

def self.table_name
  self.to_s.gsub("::", "_").tableize
end

Instance Method Details

#check_time_zoneObject



48
49
50
# File 'app/models/kryptonite/user.rb', line 48

def check_time_zone
  self.time_zone = Rails.configuration.time_zone unless self.time_zone
end

#is_admin?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'app/models/kryptonite/user.rb', line 52

def is_admin?
  access_level == $KRYPTONITE_USER_ACCESS_LEVEL_ADMIN
end

#send_create_notificationObject



32
33
34
# File 'app/models/kryptonite/user.rb', line 32

def send_create_notification
  Kryptonite::KryptoniteNotification.new_user_information(kryptonite_config_email_from_address, self, kryptonite_config_hostname, @password).deliver
end

#send_password_reset_instructionsObject



43
44
45
46
# File 'app/models/kryptonite/user.rb', line 43

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_notificationObject



36
37
38
39
40
41
# File 'app/models/kryptonite/user.rb', line 36

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