Class: Hector::ExpressionEngineIdentityAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/hector/ee_identity_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename = nil) ⇒ ExpressionEngineIdentityAdapter

Returns a new instance of ExpressionEngineIdentityAdapter.



19
20
21
22
23
# File 'lib/hector/ee_identity_adapter.rb', line 19

def initialize(filename = nil)
  @filename = filename || Hector.root.join("config/expression_engine.yml")
  load_config
  load_database
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



17
18
19
# File 'lib/hector/ee_identity_adapter.rb', line 17

def config
  @config
end

#dbObject (readonly)

Returns the value of attribute db.



17
18
19
# File 'lib/hector/ee_identity_adapter.rb', line 17

def db
  @db
end

#filenameObject (readonly)

Returns the value of attribute filename.



17
18
19
# File 'lib/hector/ee_identity_adapter.rb', line 17

def filename
  @filename
end

Instance Method Details

#authenticate(username, password) {|identity(normalize(username)) == hash(password)| ... } ⇒ Object

Yields:

  • (identity(normalize(username)) == hash(password))


25
26
27
# File 'lib/hector/ee_identity_adapter.rb', line 25

def authenticate(username, password)
  yield identity(normalize(username)) == hash(password)
end

#forget(username) ⇒ Object



34
35
36
37
# File 'lib/hector/ee_identity_adapter.rb', line 34

def forget(username)
  Hector.logger.warn "Hector cannot manage ExpressionEngine members"
  false
end

#normalize(username) ⇒ Object



39
40
41
# File 'lib/hector/ee_identity_adapter.rb', line 39

def normalize(username)
  username.strip.downcase
end

#remember(username, password) ⇒ Object



29
30
31
32
# File 'lib/hector/ee_identity_adapter.rb', line 29

def remember(username, password)
  Hector.logger.warn "Hector cannot manage ExpressionEngine members"
  false
end