Class: User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- User
- Defined in:
- app/models/user.rb
Overview
this model expects a certain database layout and its based on the name/login pattern.
Constant Summary collapse
- @@salt =
Please change the salt to something else, Every application should use a different one
'motiro'
Class Method Summary collapse
-
.authenticate(login, pass) ⇒ Object
Authenticate a user.
Instance Method Summary collapse
Class Method Details
.authenticate(login, pass) ⇒ Object
32 33 34 |
# File 'app/models/user.rb', line 32 def self.authenticate(login, pass) find(:first, :conditions => ["login = ? AND password = ?", login, sha1(pass)]) end |
Instance Method Details
#can_change_editors?(page) ⇒ Boolean
40 41 42 |
# File 'app/models/user.rb', line 40 def can_change_editors?(page) page..nil? || self == page. end |
#can_edit?(page) ⇒ Boolean
36 37 38 |
# File 'app/models/user.rb', line 36 def can_edit?(page) page.editable_by?(self) end |