Module: AuthlogicCrowd::Session

Defined in:
lib/authlogic_crowd/session.rb

Defined Under Namespace

Modules: Config, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/authlogic_crowd/session.rb', line 3

def self.included(klass)
  klass.class_eval do
    extend Config
    include InstanceMethods

    attr_accessor :new_registration

    persist :persist_by_crowd, :if => :authenticating_with_crowd?
    validate :validate_by_crowd, :if => [:authenticating_with_crowd?, :needs_crowd_validation?]
    before_destroy :logout_of_crowd, :if => :authenticating_with_crowd?
    after_create(:if => :authenticating_with_crowd?, :unless => :new_registration?) do |s|
      synchronizer = s.crowd_synchronizer
      synchronizer.local_record = s.record
      synchronizer.crowd_record = s.crowd_record
      synchronizer.sync_from_crowd
    end
  end
end