Class: Htpasswd::Acls::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/htpasswd/acls/active_record.rb

Instance Method Summary collapse

Methods inherited from Base

[], #authorize_type, #authorized?, #initialize, #pass, register, #type, #user

Constructor Details

This class inherits a constructor from Htpasswd::Acls::Base

Instance Method Details

#authorize_pass(scheme) ⇒ Object



8
9
10
11
12
13
# File 'lib/htpasswd/acls/active_record.rb', line 8

def authorize_pass(scheme)
  obj = active_record.send("find_by_%s" % (@options[:user] || :username), scheme.user)
  scheme.authorize_pass(obj[@options[:pass] || :password])
rescue
  raise IncorrectPassword
end

#authorize_user(scheme) ⇒ Object



4
5
6
# File 'lib/htpasswd/acls/active_record.rb', line 4

def authorize_user(scheme)
  active_record.send("find_by_%s" % (@options[:user] || :username), scheme.user)
end