Class: Bolt::User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/bolt/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.



24
25
26
# File 'app/models/bolt/user.rb', line 24

def notify_of_new_password
  @notify_of_new_password
end

Class Method Details

.has_more_than_one_adminObject



27
28
29
# File 'app/models/bolt/user.rb', line 27

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

.table_nameObject



12
13
14
# File 'app/models/bolt/user.rb', line 12

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

Instance Method Details

#check_time_zoneObject



47
48
49
# File 'app/models/bolt/user.rb', line 47

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

#is_admin?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/bolt/user.rb', line 51

def is_admin?
  users_groups.include?(Group.first)
end

#send_create_notificationObject



31
32
33
# File 'app/models/bolt/user.rb', line 31

def send_create_notification
  Bolt::BoltNotification.new_user_information(bolt_config_email_from_address, self, bolt_config_hostname, @password).deliver
end

#send_password_reset_instructionsObject



42
43
44
45
# File 'app/models/bolt/user.rb', line 42

def send_password_reset_instructions
  reset_perishable_token!
  Bolt::BoltNotification.password_reset_instructions(bolt_config_email_from_address, self, bolt_config_hostname).deliver
end

#send_update_notificationObject



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

def send_update_notification
  if notify_of_new_password
    notify_of_new_password = false
    Bolt::BoltNotification.generate_new_password(bolt_config_email_from_address, self, bolt_config_hostname, @password).deliver
  end
end