Module: Skyline::Authentication::User
- Included in:
- User
- Defined in:
- lib/skyline/authentication/user.rb
Overview
Use this module in your User model you want Skyline to use. By default Skyline
uses its own Skyline::User model, but you can specify your own using this
interface.
class User < ActiveRecord::Base
include Skyline::Authentication::User
def self.authenticate(email, password)
self.first(:conditions => {:email => email.to_s.downcase, :password => encrypt(password.to_s)})
end
def identification
self.id
end
def allow?(right_or_class, suffix = nil)
true
end
def display_name
self.name.present? ? self.name : self.email
end
end
Class Method Summary collapse
-
.self.authenticate(email, password) ⇒ User
Return the logged in user when successfully authenticated.
Instance Method Summary collapse
-
#allow?(right_or_class, suffix = nil) ⇒ Boolean
Check if a user has a specific right.
-
#display_name ⇒ String
Display the name or e-mailaddress of the user for display purposes.
-
#identification ⇒ Integer, String
Return the unique identifier for this user (probably the DB id).
Class Method Details
.self.authenticate(email, password) ⇒ User
Return the logged in user when successfully authenticated
43 44 45 |
# File 'lib/skyline/authentication/user.rb', line 43 def self.authenticate(email, password) raise "self.authenticate(email, password) is not implemented yet" end |
Instance Method Details
#allow?(right_or_class, suffix = nil) ⇒ Boolean
Check if a user has a specific right
66 67 68 |
# File 'lib/skyline/authentication/user.rb', line 66 def allow?(right_or_class, suffix = nil) raise "allow?(right_or_class, suffix = nil) is not implemented yet" end |
#display_name ⇒ String
Display the name or e-mailaddress of the user for display purposes.
77 78 79 |
# File 'lib/skyline/authentication/user.rb', line 77 def display_name raise "display_name is not implemented yet" end |
#identification ⇒ Integer, String
Return the unique identifier for this user (probably the DB id)
50 51 52 |
# File 'lib/skyline/authentication/user.rb', line 50 def identification raise "identification is not implemented yet" end |