3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# 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?
before_persisting {|s| s.instance_variable_set('@persisted_by_crowd', false)}
after_persisting(:if => [:authenticating_with_crowd?, :persisted_by_crowd?, :explicit_login_from_crowd_token?], :unless => :new_registration?) do |s|
s.before_save
s.new_session? ? s.before_create : s.before_update
s.new_session? ? s.after_create : s.after_update
s.after_save
end
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
|