Class: User

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/lokka/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



14
15
16
# File 'lib/lokka/user.rb', line 14

def password
  @password
end

#password_confirmationObject

Returns the value of attribute password_confirmation.



14
15
16
# File 'lib/lokka/user.rb', line 14

def password_confirmation
  @password_confirmation
end

Class Method Details

.authenticate(name, pass) ⇒ Object



28
29
30
31
32
33
# File 'lib/lokka/user.rb', line 28

def self.authenticate(name, pass)
  current_user = first(:name => name)
  return nil if current_user.nil?
  return current_user if User.encrypt(pass, current_user.salt) == current_user.hashed_password
  nil
end

Instance Method Details

#admin?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/lokka/user.rb', line 35

def admin?
  permission_level == 1
end