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
Authenticate a user.
Example:
@user = User.authenticate('bob', 'bobpass')
33 34 35 |
# File 'app/models/user.rb', line 33 def self.authenticate(login, pass) find(:first, :conditions => ["login = ? AND password = ?", login, sha1(pass)]) end |
Instance Method Details
#can_change_editors?(page) ⇒ Boolean
43 44 45 |
# File 'app/models/user.rb', line 43 def can_change_editors?(page) page..nil? || self == page. end |
#can_edit?(page) ⇒ Boolean
37 38 39 40 41 |
# File 'app/models/user.rb', line 37 def can_edit?(page) self == page. || page.is_open_to_all? || page.editors.split.include?(login) end |