infopark_reactor 1.9.1 → 1.10.0.beta

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 432173125e16982290bf5e7eb40370e0f37585d5
4
- data.tar.gz: 2d7268785b33578ddee8890d8a2ac92deb3b1b91
3
+ metadata.gz: 58b80269428f681b9bd1375c20c6640c7aa0160e
4
+ data.tar.gz: e26a90fb05c668147402917ba45fb94bc769f00b
5
5
  SHA512:
6
- metadata.gz: 00ffdd16e4a53f1246861515d148ccf7031e4aa1a2b6cbf2f5e809ed806269357db74c467d031e7c1abcd80bcb00f80a5df5bcfde862035eb1acf2d3a1681bbe
7
- data.tar.gz: 7b1bfb1775ed0df349f555d0971beee2e323520c27a5c022ce490a50d7f86b29ea10ed32c97d518c5192504f2b71ea8ab91d88b9dfa8e07323ce8c6d6b6ecb11
6
+ metadata.gz: 5c4ce7c7f0a82236966a5e0b3649aa5de302e3f5bd57dec6a90143b1d3380bb70e9cd63bd1682e484572f9ef24a20a994c9ebbbd76f02fb67dab2a38cf023bb5
7
+ data.tar.gz: 345721a55faaaf7f0cc400f4d31e9db040d648645fe18ec22114c2615e8cbb21af3f02fcd633e2f92d866664af85928b053f95a2b422124a0865eed0de4e471e
@@ -40,7 +40,6 @@ require 'reactor/streaming_upload'
40
40
 
41
41
  # require rails integration
42
42
  require 'reactor/session'
43
- require 'reactor/session/observers'
44
43
  require 'reactor/session/user'
45
44
 
46
45
  # require engine
@@ -1,33 +1,25 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require 'reactor/session'
3
2
 
4
- module Reactor::Session::Observers
5
- class PermissionCacheInvalidator
6
- def update(user_name)
7
- #puts '%%% invalidating permission cache'
8
- Reactor::Cache::Permission.instance.invalidate(user_name)
9
- end
10
- end
3
+ module Reactor
4
+ class Session
5
+ module Observers
6
+ class PermissionCacheInvalidator
7
+ def update(user_name, new_login=false)
8
+ Reactor::Cache::Permission.instance.invalidate(user_name) if new_login
9
+ end
10
+ end
11
11
 
12
- class UserCacheInvalidator
13
- def update(user_name)
14
- #puts '%%% invalidating user cache'
15
- Reactor::Cache::User.instance.invalidate(user_name)
16
- end
17
- end
18
-
19
- class CmsAccessDataPropagator
20
- def update(user_name)
21
- #puts '%%% propagating user'
22
- Reactor::Configuration.xml_access[:username] = user_name
23
- end
24
- end
12
+ class UserCacheInvalidator
13
+ def update(user_name, new_login=false)
14
+ Reactor::Cache::User.instance.invalidate(user_name) if new_login
15
+ end
16
+ end
25
17
 
26
- self.constants.each do |possible_observer_name|
27
- possible_observer = self.const_get(possible_observer_name)
28
- if possible_observer.method_defined?(:update)
29
- Reactor::Session.instance.add_observer(possible_observer.new)
18
+ class CmsAccessDataPropagator
19
+ def update(user_name, new_login=false)
20
+ Reactor::Configuration.xml_access[:username] = user_name
21
+ end
22
+ end
30
23
  end
31
24
  end
32
25
  end
33
-
@@ -1,15 +1,33 @@
1
1
  # -*- encoding : utf-8 -*-
2
- require 'singleton'
3
2
  require 'observer'
4
3
 
5
4
  require 'reactor/cm/bridge'
6
5
  require 'reactor/cache/user'
6
+ require 'reactor/session/observers'
7
7
 
8
8
  class Reactor::Session
9
9
  attr_reader :user_name, :session_id
10
- include Singleton
11
10
  include Observable
12
11
 
12
+ def self.instance
13
+ self.new
14
+ end
15
+
16
+ def marshal_dump
17
+ [@user_name, @session_id]
18
+ end
19
+
20
+ def marshal_load(array)
21
+ @user_name, @session_id = array
22
+ self.add_observers
23
+ self.proper_notify_observers(@user_name, false)
24
+ end
25
+
26
+ def initialize
27
+ self.add_observers
28
+ end
29
+
30
+
13
31
  def login(session_id)
14
32
  if !logged_in?(session_id)
15
33
  self.user_name = authenticate(session_id)
@@ -34,8 +52,8 @@ class Reactor::Session
34
52
 
35
53
  def user_name=(new_user_name)
36
54
  @user_name = new_user_name
37
- changed(true) # I will find and burn your house to the ground if you remove this line
38
- notify_observers(@user_name)
55
+ self.proper_notify_observers(@user_name, true)
56
+ @user_name
39
57
  end
40
58
 
41
59
  protected
@@ -46,4 +64,17 @@ class Reactor::Session
46
64
  Reactor::Cm::Bridge.login_for(session_id)
47
65
  end
48
66
 
67
+ def add_observers
68
+ Observers.constants.each do |possible_observer_name|
69
+ possible_observer = Observers.const_get(possible_observer_name)
70
+ if possible_observer.method_defined?(:update)
71
+ self.add_observer(possible_observer.new)
72
+ end
73
+ end
74
+ end
75
+
76
+ def proper_notify_observers(*args)
77
+ self.changed(true)
78
+ self.notify_observers(*args)
79
+ end
49
80
  end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Reactor
3
- VERSION = "1.9.1"
3
+ VERSION = "1.10.0.beta"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_reactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.10.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-16 00:00:00.000000000 Z
11
+ date: 2014-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -149,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - '>='
152
+ - - '>'
153
153
  - !ruby/object:Gem::Version
154
- version: '0'
154
+ version: 1.3.1
155
155
  requirements: []
156
156
  rubyforge_project:
157
157
  rubygems_version: 2.0.14