infopark_reactor 1.25.2 → 1.27.0.rc8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +25 -0
- data/.rubocop_todo.yml +363 -0
- data/Rakefile +10 -13
- data/app/models/rails_connector/abstract_obj.rb +2 -1
- data/config/routes.rb +0 -1
- data/infopark_reactor.gemspec +16 -15
- data/lib/generators/cm/migration/migration_generator.rb +4 -8
- data/lib/infopark_reactor.rb +43 -69
- data/lib/reactor/already_released.rb +1 -2
- data/lib/reactor/attributes.rb +94 -270
- data/lib/reactor/attributes/date_serializer.rb +23 -16
- data/lib/reactor/attributes/html_serializer.rb +6 -5
- data/lib/reactor/attributes/link_list_extender.rb +10 -8
- data/lib/reactor/attributes/link_list_from_accessor.rb +2 -1
- data/lib/reactor/attributes/link_list_from_attr_values.rb +2 -1
- data/lib/reactor/attributes/link_list_serializer.rb +8 -7
- data/lib/reactor/attributes_handlers.rb +164 -0
- data/lib/reactor/cache/permission.rb +6 -9
- data/lib/reactor/cache/user.rb +3 -6
- data/lib/reactor/cm/attribute.rb +16 -16
- data/lib/reactor/cm/attribute_group.rb +18 -21
- data/lib/reactor/cm/blob_too_small_error.rb +2 -2
- data/lib/reactor/cm/bridge.rb +6 -9
- data/lib/reactor/cm/channel.rb +3 -4
- data/lib/reactor/cm/editorial_group.rb +2 -9
- data/lib/reactor/cm/group.rb +30 -43
- data/lib/reactor/cm/job.rb +77 -0
- data/lib/reactor/cm/language.rb +21 -22
- data/lib/reactor/cm/link.rb +38 -40
- data/lib/reactor/cm/live_group.rb +2 -9
- data/lib/reactor/cm/log_entry.rb +22 -21
- data/lib/reactor/cm/missing_credentials.rb +3 -2
- data/lib/reactor/cm/multi_xml_request.rb +22 -25
- data/lib/reactor/cm/obj.rb +161 -152
- data/lib/reactor/cm/obj_class.rb +52 -51
- data/lib/reactor/cm/object_base.rb +26 -21
- data/lib/reactor/cm/permissions.rb +7 -7
- data/lib/reactor/cm/user.rb +43 -51
- data/lib/reactor/cm/workflow.rb +11 -12
- data/lib/reactor/cm/xml_attribute.rb +10 -19
- data/lib/reactor/cm/xml_markup.rb +7 -10
- data/lib/reactor/cm/xml_multi_request_error.rb +1 -3
- data/lib/reactor/cm/xml_request.rb +21 -29
- data/lib/reactor/cm/xml_request_error.rb +1 -3
- data/lib/reactor/cm/xml_response.rb +8 -16
- data/lib/reactor/cm/xml_single_request_error.rb +3 -5
- data/lib/reactor/configuration.rb +1 -3
- data/lib/reactor/engine.rb +5 -10
- data/lib/reactor/legacy.rb +8 -9
- data/lib/reactor/link/external.rb +8 -5
- data/lib/reactor/link/internal.rb +8 -5
- data/lib/reactor/link/temporary_link.rb +18 -19
- data/lib/reactor/main.rb +11 -15
- data/lib/reactor/migration.rb +52 -47
- data/lib/reactor/no_working_version.rb +1 -2
- data/lib/reactor/not_permitted.rb +1 -2
- data/lib/reactor/permission.rb +36 -38
- data/lib/reactor/persistence.rb +105 -159
- data/lib/reactor/plans/common_attribute.rb +7 -7
- data/lib/reactor/plans/common_attribute_group.rb +6 -6
- data/lib/reactor/plans/common_channel.rb +6 -6
- data/lib/reactor/plans/common_group.rb +7 -14
- data/lib/reactor/plans/common_job.rb +32 -0
- data/lib/reactor/plans/common_obj_class.rb +11 -11
- data/lib/reactor/plans/create_attribute.rb +1 -3
- data/lib/reactor/plans/create_attribute_group.rb +1 -3
- data/lib/reactor/plans/create_channel.rb +2 -3
- data/lib/reactor/plans/create_group.rb +3 -10
- data/lib/reactor/plans/create_job.rb +22 -0
- data/lib/reactor/plans/create_obj.rb +12 -14
- data/lib/reactor/plans/create_obj_class.rb +1 -2
- data/lib/reactor/plans/delete_attribute.rb +1 -3
- data/lib/reactor/plans/delete_attribute_group.rb +2 -4
- data/lib/reactor/plans/delete_channel.rb +4 -4
- data/lib/reactor/plans/delete_group.rb +2 -9
- data/lib/reactor/plans/delete_job.rb +23 -0
- data/lib/reactor/plans/delete_obj.rb +3 -4
- data/lib/reactor/plans/delete_obj_class.rb +1 -2
- data/lib/reactor/plans/prepared.rb +3 -4
- data/lib/reactor/plans/rename_group.rb +4 -11
- data/lib/reactor/plans/rename_obj_class.rb +1 -2
- data/lib/reactor/plans/update_attribute.rb +1 -3
- data/lib/reactor/plans/update_attribute_group.rb +2 -4
- data/lib/reactor/plans/update_group.rb +2 -9
- data/lib/reactor/plans/update_job.rb +27 -0
- data/lib/reactor/plans/update_obj.rb +6 -7
- data/lib/reactor/plans/update_obj_class.rb +0 -2
- data/lib/reactor/rc_independent.rb +0 -1
- data/lib/reactor/session.rb +27 -31
- data/lib/reactor/session/observers.rb +3 -5
- data/lib/reactor/session/user.rb +6 -7
- data/lib/reactor/session_helper/auth_filter.rb +9 -0
- data/lib/reactor/session_helper/auth_helper.rb +24 -0
- data/lib/reactor/session_helper/rsession_helper.rb +16 -0
- data/lib/reactor/session_helper/session_state.rb +31 -0
- data/lib/reactor/streaming_upload.rb +0 -1
- data/lib/reactor/sudo.rb +2 -3
- data/lib/reactor/support/link_matcher.rb +8 -7
- data/lib/reactor/tools/migrator.rb +30 -35
- data/lib/reactor/tools/response_handler/xml_attribute.rb +37 -27
- data/lib/reactor/tools/smart_xml_logger.rb +20 -22
- data/lib/reactor/tools/sower.rb +22 -23
- data/lib/reactor/tools/uploader.rb +12 -17
- data/lib/reactor/tools/versioner.rb +29 -30
- data/lib/reactor/tools/where_query.rb +11 -14
- data/lib/reactor/tools/workflow_generator.rb +26 -28
- data/lib/reactor/tools/xml_attributes.rb +7 -14
- data/lib/reactor/tools/xpath_extractor.rb +2 -1
- data/lib/reactor/validations.rb +20 -16
- data/lib/reactor/version.rb +1 -2
- data/lib/reactor/workflow.rb +10 -33
- data/lib/reactor/workflow/comment.rb +28 -0
- data/lib/reactor/workflow/empty.rb +0 -1
- data/lib/reactor/workflow/standard.rb +4 -3
- data/lib/tasks/cm_migrate.rake +3 -3
- data/lib/tasks/cm_seeds.rake +9 -16
- metadata +81 -39
- data/app/models/rails_connector/abstract_model.rb +0 -7
- data/app/models/rails_connector/attribute.rb +0 -94
- data/app/models/rails_connector/blob_mapping.rb +0 -16
- data/app/models/rails_connector/channel.rb +0 -41
- data/app/models/rails_connector/content.rb +0 -12
- data/app/models/rails_connector/obj_class.rb +0 -158
- data/app/models/rails_connector/obj_class_attr.rb +0 -5
- data/app/models/rails_connector/object_with_meta_data.rb +0 -18
- data/lib/rails_connector/meta/eager_loader.rb +0 -91
- data/lib/reactor/rails_connector_meta.rb +0 -149
- data/lib/reactor/session_helper.rb +0 -72
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'reactor/plans/common_attribute_group'
|
1
|
+
require "reactor/plans/common_attribute_group"
|
3
2
|
|
4
3
|
module Reactor
|
5
4
|
module Plans
|
@@ -15,14 +14,13 @@ module Reactor
|
|
15
14
|
def prepare!
|
16
15
|
error("name ist nil") if @name.nil?
|
17
16
|
error("obj_class is nil") if @obj_class.nil?
|
18
|
-
error("attribute group #{@pk} does not exist")
|
17
|
+
error("attribute group #{@pk} does not exist") unless Reactor::Cm::AttributeGroup.exists?(@pk)
|
19
18
|
end
|
20
19
|
|
21
20
|
def migrate!
|
22
21
|
attrib = Reactor::Cm::AttributeGroup.get(@pk)
|
23
22
|
attrib.delete!
|
24
23
|
end
|
25
|
-
|
26
24
|
end
|
27
25
|
end
|
28
26
|
end
|
@@ -1,7 +1,8 @@
|
|
1
|
-
|
1
|
+
require "reactor/cm/channel"
|
2
|
+
require "reactor/plans/common_channel"
|
2
3
|
module Reactor
|
3
4
|
module Plans
|
4
|
-
class DeleteChannel <
|
5
|
+
class DeleteChannel < CommonChannel
|
5
6
|
def initialize(*args)
|
6
7
|
super()
|
7
8
|
(name, x), options = separate_arguments(*args)
|
@@ -10,13 +11,12 @@ module Reactor
|
|
10
11
|
|
11
12
|
def prepare!
|
12
13
|
error("name is nil") if @name.nil?
|
13
|
-
error("channel #{@name} does not exist")
|
14
|
+
error("channel #{@name} does not exist") unless Reactor::Cm::Channel.exists?(@name)
|
14
15
|
end
|
15
16
|
|
16
17
|
def migrate!
|
17
18
|
Reactor::Cm::Channel.get(@name).delete!
|
18
19
|
end
|
19
|
-
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -1,19 +1,15 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
|
-
|
4
2
|
module Plans
|
5
|
-
|
6
3
|
class DeleteGroup < CommonGroup
|
7
|
-
|
8
4
|
def initialize(*args)
|
9
5
|
super()
|
10
6
|
|
11
|
-
(name,
|
7
|
+
(name,), options = separate_arguments(*args)
|
12
8
|
@name = name || options[:name]
|
13
9
|
end
|
14
10
|
|
15
11
|
def prepare!
|
16
|
-
error(
|
12
|
+
error("name is nil") if @name.nil?
|
17
13
|
error("group #{@name} does not exist") unless Reactor::Cm::Group.exists?(@name)
|
18
14
|
end
|
19
15
|
|
@@ -21,9 +17,6 @@ module Reactor
|
|
21
17
|
group = Reactor::Cm::Group.get(@name)
|
22
18
|
group.delete!
|
23
19
|
end
|
24
|
-
|
25
20
|
end
|
26
|
-
|
27
21
|
end
|
28
|
-
|
29
22
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "reactor/cm/job"
|
2
|
+
require "reactor/plans/common_job"
|
3
|
+
|
4
|
+
module Reactor
|
5
|
+
module Plans
|
6
|
+
class DeleteJob < CommonJob
|
7
|
+
def initialize(*args)
|
8
|
+
super()
|
9
|
+
(name, x), options = separate_arguments(*args)
|
10
|
+
@name = name || options[:name]
|
11
|
+
end
|
12
|
+
|
13
|
+
def prepare!
|
14
|
+
error("name is nil") if @name.nil?
|
15
|
+
error("job #{@name} does not exist") unless Reactor::Cm::Job.exists?(@name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def migrate!
|
19
|
+
Reactor::Cm::Job.delete!(@name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,17 +1,16 @@
|
|
1
|
-
|
2
|
-
require 'reactor/plans/prepared'
|
1
|
+
require "reactor/plans/prepared"
|
3
2
|
|
4
3
|
module Reactor
|
5
4
|
module Plans
|
6
5
|
class DeleteObj
|
7
6
|
include Prepared
|
8
7
|
|
9
|
-
def initialize(opts={})
|
8
|
+
def initialize(opts = {})
|
10
9
|
@key = opts[:obj_id] || opts[:path]
|
11
10
|
end
|
12
11
|
|
13
12
|
def prepare!
|
14
|
-
error("object (key=#{@key}) not found")
|
13
|
+
error("object (key=#{@key}) not found") unless Reactor::Cm::Obj.exists?(@key)
|
15
14
|
end
|
16
15
|
|
17
16
|
def migrate!
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
2
|
module Plans
|
4
3
|
class DeleteObjClass < CommonObjClass
|
@@ -11,7 +10,7 @@ module Reactor
|
|
11
10
|
end
|
12
11
|
|
13
12
|
def prepare!
|
14
|
-
error("objClass #{@name} not found")
|
13
|
+
error("objClass #{@name} not found") unless Reactor::Cm::ObjClass.exists?(@name)
|
15
14
|
end
|
16
15
|
|
17
16
|
def migrate!
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
2
|
module Plans
|
4
3
|
module Prepared
|
@@ -7,9 +6,9 @@ module Reactor
|
|
7
6
|
end
|
8
7
|
|
9
8
|
def separate_arguments(*args)
|
10
|
-
array_args = args.select {|a| !a.is_a?(Hash) }
|
11
|
-
hash_args = args.select {|a| a.is_a?(Hash) }.reduce({}, &:merge)
|
12
|
-
|
9
|
+
array_args = args.select { |a| !a.is_a?(Hash) }
|
10
|
+
hash_args = args.select { |a| a.is_a?(Hash) }.reduce({}, &:merge)
|
11
|
+
[array_args, hash_args]
|
13
12
|
end
|
14
13
|
end
|
15
14
|
end
|
@@ -1,10 +1,6 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
|
-
|
4
2
|
module Plans
|
5
|
-
|
6
3
|
class RenameGroup
|
7
|
-
|
8
4
|
include Prepared
|
9
5
|
|
10
6
|
def initialize(*args)
|
@@ -15,19 +11,16 @@ module Reactor
|
|
15
11
|
end
|
16
12
|
|
17
13
|
def prepare!
|
18
|
-
error(
|
19
|
-
error(
|
20
|
-
error(
|
21
|
-
error(
|
14
|
+
error("from is nil") if @from.nil?
|
15
|
+
error("to is nil") if @to.nil?
|
16
|
+
error("from does not exist") unless Reactor::Cm::Group.exists?(@from)
|
17
|
+
error("to does exist") if Reactor::Cm::Group.exists?(@to)
|
22
18
|
end
|
23
19
|
|
24
20
|
def migrate!
|
25
21
|
group = Reactor::Cm::Group.get(@from)
|
26
22
|
group.rename!(@to)
|
27
23
|
end
|
28
|
-
|
29
24
|
end
|
30
|
-
|
31
25
|
end
|
32
|
-
|
33
26
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
2
|
module Plans
|
4
3
|
class RenameObjClass
|
@@ -13,7 +12,7 @@ module Reactor
|
|
13
12
|
def prepare!
|
14
13
|
error("from is nil") if @from.nil?
|
15
14
|
error("to is nil") if @to.nil?
|
16
|
-
error("from does not exist")
|
15
|
+
error("from does not exist") unless Reactor::Cm::ObjClass.exists?(@from)
|
17
16
|
error("to does exist") if Reactor::Cm::ObjClass.exists?(@to)
|
18
17
|
end
|
19
18
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
2
|
module Plans
|
4
3
|
class UpdateAttribute < CommonAttribute
|
@@ -10,7 +9,7 @@ module Reactor
|
|
10
9
|
|
11
10
|
def prepapre!
|
12
11
|
error("name is nil") if @name.nil?
|
13
|
-
error("attribute #{@name} not found")
|
12
|
+
error("attribute #{@name} not found") unless Reactor::Cm::Attribute.exists?(@name)
|
14
13
|
prepare_params!(nil)
|
15
14
|
end
|
16
15
|
|
@@ -18,7 +17,6 @@ module Reactor
|
|
18
17
|
attrib = Reactor::Cm::Attribute.get(@name)
|
19
18
|
migrate_params!(attrib)
|
20
19
|
end
|
21
|
-
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'reactor/plans/common_attribute_group'
|
1
|
+
require "reactor/plans/common_attribute_group"
|
3
2
|
|
4
3
|
module Reactor
|
5
4
|
module Plans
|
@@ -15,7 +14,7 @@ module Reactor
|
|
15
14
|
def prepapre!
|
16
15
|
error("name ist nil") if @name.nil?
|
17
16
|
error("obj_class is nil") if @obj_class.nil?
|
18
|
-
error("attribute group #{@pk} does not exist")
|
17
|
+
error("attribute group #{@pk} does not exist") unless Reactor::Cm::AttributeGroup.exists?(ok)
|
19
18
|
prepare_params!(nil)
|
20
19
|
end
|
21
20
|
|
@@ -23,7 +22,6 @@ module Reactor
|
|
23
22
|
attrib = Reactor::Cm::AttributeGroup.get(@pk)
|
24
23
|
migrate_params!(attrib)
|
25
24
|
end
|
26
|
-
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
@@ -1,19 +1,15 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
|
-
|
4
2
|
module Plans
|
5
|
-
|
6
3
|
class UpdateGroup < CommonGroup
|
7
|
-
|
8
4
|
def initialize(*args)
|
9
5
|
super()
|
10
6
|
|
11
|
-
(name,
|
7
|
+
(name,), options = separate_arguments(*args)
|
12
8
|
@name = name || options[:name]
|
13
9
|
end
|
14
10
|
|
15
11
|
def prepapre!
|
16
|
-
error(
|
12
|
+
error("name is nil") if @name.nil?
|
17
13
|
error("group #{@name} not found") unless Reactor::Cm::Group.exists?(@name)
|
18
14
|
|
19
15
|
prepare_params!(nil)
|
@@ -23,9 +19,6 @@ module Reactor
|
|
23
19
|
group = Reactor::Cm::Group.get(@name)
|
24
20
|
migrate_params!(group)
|
25
21
|
end
|
26
|
-
|
27
22
|
end
|
28
|
-
|
29
23
|
end
|
30
|
-
|
31
24
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "reactor/cm/job"
|
2
|
+
require "reactor/plans/common_job"
|
3
|
+
|
4
|
+
module Reactor
|
5
|
+
module Plans
|
6
|
+
class UpdateJob < CommonJob
|
7
|
+
def initialize(*args)
|
8
|
+
super()
|
9
|
+
|
10
|
+
(name,), options = separate_arguments(*args)
|
11
|
+
@name = name || options[:name]
|
12
|
+
end
|
13
|
+
|
14
|
+
def prepapre!
|
15
|
+
error("name is nil") if @name.nil?
|
16
|
+
error("job #{@name} not found") unless Reactor::Cm::Job.exists?(@name)
|
17
|
+
|
18
|
+
prepare_params!(nil)
|
19
|
+
end
|
20
|
+
|
21
|
+
def migrate!
|
22
|
+
job = Reactor::Cm::Job.get(@name)
|
23
|
+
migrate_params!(job)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
2
|
module Plans
|
4
3
|
class UpdateObj
|
5
4
|
include Prepared
|
6
5
|
|
7
|
-
def initialize(opts={})
|
6
|
+
def initialize(opts = {})
|
8
7
|
@key = opts[:obj_id] || opts[:path]
|
9
8
|
@attrs = {}
|
10
9
|
end
|
@@ -14,14 +13,14 @@ module Reactor
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def prepare!
|
17
|
-
error("object (key=#{@key}) not found")
|
18
|
-
#TODO: attribute check
|
16
|
+
error("object (key=#{@key}) not found") unless Reactor::Cm::Obj.exists?(@key)
|
17
|
+
# TODO: attribute check
|
19
18
|
end
|
20
19
|
|
21
20
|
def migrate!
|
22
|
-
|
23
|
-
@attrs.each do |key,value|
|
24
|
-
@obj.set(key,value)
|
21
|
+
Reactor::Cm::Obj.get(@key)
|
22
|
+
@attrs.each do |key, value|
|
23
|
+
@obj.set(key, value)
|
25
24
|
end
|
26
25
|
@obj.save!
|
27
26
|
@obj.release!
|
data/lib/reactor/session.rb
CHANGED
@@ -1,33 +1,32 @@
|
|
1
|
-
|
2
|
-
require 'observer'
|
1
|
+
require "observer"
|
3
2
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "reactor/cm/bridge"
|
4
|
+
require "reactor/cache/user"
|
5
|
+
require "reactor/session/observers"
|
7
6
|
|
8
7
|
class Reactor::Session
|
9
8
|
include Observable
|
10
9
|
|
11
10
|
class State < Struct.new(:user_name, :session_id)
|
12
11
|
def serialize
|
13
|
-
[
|
12
|
+
[user_name, session_id]
|
14
13
|
end
|
15
14
|
|
16
15
|
def self.deserialize(array)
|
17
|
-
|
16
|
+
new(*array)
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
|
-
def initialize(state=State.new)
|
22
|
-
|
20
|
+
def initialize(state = State.new)
|
21
|
+
initialize_and_notify(state)
|
23
22
|
end
|
24
23
|
|
25
24
|
def user_name
|
26
|
-
|
25
|
+
state.user_name
|
27
26
|
end
|
28
27
|
|
29
28
|
def session_id
|
30
|
-
|
29
|
+
state.session_id
|
31
30
|
end
|
32
31
|
|
33
32
|
def self.instance
|
@@ -35,13 +34,11 @@ class Reactor::Session
|
|
35
34
|
end
|
36
35
|
|
37
36
|
def self.for(user_name)
|
38
|
-
|
37
|
+
new(State.new(user_name, nil))
|
39
38
|
end
|
40
39
|
|
41
40
|
def login(session_id)
|
42
|
-
|
43
|
-
self.user_name = authenticate(session_id)
|
44
|
-
end
|
41
|
+
self.user_name = authenticate(session_id) unless logged_in?(session_id)
|
45
42
|
end
|
46
43
|
|
47
44
|
def destroy
|
@@ -49,37 +46,38 @@ class Reactor::Session
|
|
49
46
|
end
|
50
47
|
|
51
48
|
def logged_in?(session_id)
|
52
|
-
self.session_id.present? &&
|
49
|
+
self.session_id.present? && user? && self.session_id == session_id
|
53
50
|
end
|
54
51
|
|
55
52
|
def user?
|
56
|
-
|
53
|
+
user_name.present?
|
57
54
|
end
|
58
55
|
|
59
56
|
def user
|
60
|
-
Reactor::Cache::User.instance.get(
|
57
|
+
Reactor::Cache::User.instance.get(user_name)
|
61
58
|
end
|
62
59
|
|
63
60
|
def user_name=(new_user_name)
|
64
|
-
|
65
|
-
|
66
|
-
new_user_name
|
61
|
+
state.user_name = new_user_name
|
62
|
+
proper_notify_observers(new_user_name, true)
|
67
63
|
end
|
68
64
|
|
69
65
|
def marshal_dump
|
70
|
-
|
66
|
+
state.serialize
|
71
67
|
end
|
72
68
|
|
73
69
|
def marshal_load(array)
|
74
|
-
|
70
|
+
initialize_and_notify(State.deserialize(array))
|
75
71
|
end
|
76
72
|
|
77
73
|
protected
|
74
|
+
|
78
75
|
attr_accessor :state
|
76
|
+
|
79
77
|
def initialize_and_notify(state)
|
80
78
|
self.state = state
|
81
|
-
|
82
|
-
|
79
|
+
add_observers
|
80
|
+
proper_notify_observers(user_name, false)
|
83
81
|
end
|
84
82
|
|
85
83
|
def authenticate(session_id)
|
@@ -90,18 +88,16 @@ class Reactor::Session
|
|
90
88
|
def add_observers
|
91
89
|
Observers.constants.each do |possible_observer_name|
|
92
90
|
possible_observer = Observers.const_get(possible_observer_name)
|
93
|
-
if possible_observer.method_defined?(:update)
|
94
|
-
self.add_observer(possible_observer.new)
|
95
|
-
end
|
91
|
+
add_observer(possible_observer.new) if possible_observer.method_defined?(:update)
|
96
92
|
end
|
97
93
|
end
|
98
94
|
|
99
95
|
def proper_notify_observers(*args)
|
100
|
-
|
101
|
-
|
96
|
+
changed(true)
|
97
|
+
notify_observers(*args)
|
102
98
|
end
|
103
99
|
|
104
100
|
def session_id=(new_session_id)
|
105
|
-
|
101
|
+
state.session_id = new_session_id
|
106
102
|
end
|
107
103
|
end
|