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 +4 -4
- data/lib/infopark_reactor.rb +0 -1
- data/lib/reactor/session/observers.rb +18 -26
- data/lib/reactor/session.rb +35 -4
- data/lib/reactor/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58b80269428f681b9bd1375c20c6640c7aa0160e
|
4
|
+
data.tar.gz: e26a90fb05c668147402917ba45fb94bc769f00b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c4ce7c7f0a82236966a5e0b3649aa5de302e3f5bd57dec6a90143b1d3380bb70e9cd63bd1682e484572f9ef24a20a994c9ebbbd76f02fb67dab2a38cf023bb5
|
7
|
+
data.tar.gz: 345721a55faaaf7f0cc400f4d31e9db040d648645fe18ec22114c2615e8cbb21af3f02fcd633e2f92d866664af85928b053f95a2b422124a0865eed0de4e471e
|
data/lib/infopark_reactor.rb
CHANGED
@@ -1,33 +1,25 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
|
-
require 'reactor/session'
|
3
2
|
|
4
|
-
module Reactor
|
5
|
-
class
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
data/lib/reactor/session.rb
CHANGED
@@ -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
|
-
|
38
|
-
|
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
|
data/lib/reactor/version.rb
CHANGED
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.
|
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-
|
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:
|
154
|
+
version: 1.3.1
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
157
|
rubygems_version: 2.0.14
|