infopark_reactor 1.26.1 → 1.27.0.rc4
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 +92 -268
- data/lib/reactor/attributes/date_serializer.rb +20 -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 +23 -25
- 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 +159 -154
- 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 +6 -7
- data/lib/reactor/link/external.rb +8 -5
- data/lib/reactor/link/internal.rb +8 -5
- data/lib/reactor/link/temporary_link.rb +16 -17
- data/lib/reactor/main.rb +11 -15
- data/lib/reactor/migration.rb +52 -53
- 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 +104 -178
- 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 +6 -6
- 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 +3 -4
- 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 +3 -6
- data/lib/reactor/plans/delete_group.rb +2 -9
- data/lib/reactor/plans/delete_job.rb +3 -5
- 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 +4 -8
- 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 +27 -33
- 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 +64 -28
- 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/job.rb +0 -14
- 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,15 +1,18 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
2
|
module Link
|
4
3
|
class Internal
|
5
4
|
attr_accessor :destination_object
|
6
5
|
|
7
|
-
def external?
|
8
|
-
|
6
|
+
def external?
|
7
|
+
false
|
8
|
+
end
|
9
|
+
|
10
|
+
def internal?
|
11
|
+
true
|
12
|
+
end
|
9
13
|
|
10
|
-
def initialize(
|
14
|
+
def initialize(_anything)
|
11
15
|
raise TypeError, "#{self.class.name} is deprecated!"
|
12
|
-
self.destination_object = Obj.obj_from_anything(anything)
|
13
16
|
end
|
14
17
|
|
15
18
|
def id
|
@@ -1,13 +1,16 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
1
|
module Reactor
|
3
2
|
module Link
|
4
3
|
class TemporaryLink
|
5
4
|
attr_reader :url
|
6
|
-
attr_accessor :title
|
7
|
-
attr_accessor :target
|
5
|
+
attr_accessor :title, :target
|
8
6
|
|
9
|
-
def external?
|
10
|
-
|
7
|
+
def external?
|
8
|
+
raise TypeError, "This link needs to be persisted to gain any meaningful information"
|
9
|
+
end
|
10
|
+
|
11
|
+
def internal?
|
12
|
+
false
|
13
|
+
end
|
11
14
|
|
12
15
|
def initialize(anything)
|
13
16
|
link_data = {}
|
@@ -21,24 +24,20 @@ module Reactor
|
|
21
24
|
link_data[:url] = anything
|
22
25
|
end
|
23
26
|
|
24
|
-
self.url
|
25
|
-
if link_data[:search].present?
|
26
|
-
|
27
|
-
end
|
28
|
-
if link_data[:fragment].present?
|
29
|
-
self.url = "#{self.url}##{link_data[:fragment]}"
|
30
|
-
end
|
27
|
+
self.url = link_data[:url] || link_data[:destination_object]
|
28
|
+
self.url = "#{url}?#{link_data[:search]}" if link_data[:search].present?
|
29
|
+
self.url = "#{url}##{link_data[:fragment]}" if link_data[:fragment].present?
|
31
30
|
self.target = link_data[:target] if link_data.key?(:target)
|
32
31
|
self.title = link_data[:title] if link_data.key?(:title)
|
33
32
|
end
|
34
33
|
|
35
34
|
def url=(some_target)
|
36
35
|
@url = case some_target
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
when RailsConnector::AbstractObj
|
37
|
+
@destination_object = some_target
|
38
|
+
some_target.path
|
39
|
+
else
|
40
|
+
some_target
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
data/lib/reactor/main.rb
CHANGED
@@ -1,21 +1,17 @@
|
|
1
|
-
require 'reactor/rails_connector_meta'
|
2
|
-
require 'reactor/legacy'
|
3
|
-
require 'reactor/attributes'
|
4
|
-
require 'reactor/persistence'
|
5
|
-
require 'reactor/validations'
|
6
|
-
require 'reactor/permission'
|
7
|
-
require 'reactor/workflow'
|
8
|
-
require 'reactor/streaming_upload'
|
9
|
-
|
10
1
|
module Reactor
|
11
2
|
module Main
|
12
3
|
def self.included(base)
|
13
|
-
[
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
4
|
+
[
|
5
|
+
Reactor::Legacy::Base,
|
6
|
+
Reactor::Attributes::Base,
|
7
|
+
Reactor::Persistence::Base,
|
8
|
+
Reactor::Validations::Base,
|
9
|
+
Reactor::Permission::Base,
|
10
|
+
Reactor::Workflow::Base,
|
11
|
+
Reactor::StreamingUpload::Base
|
12
|
+
].each do |mod|
|
13
|
+
base.send(:include, mod)
|
14
|
+
end
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
data/lib/reactor/migration.rb
CHANGED
@@ -1,58 +1,57 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require 'reactor/plans/delete_job'
|
1
|
+
require "reactor/plans/create_obj"
|
2
|
+
require "reactor/plans/delete_obj"
|
3
|
+
require "reactor/plans/update_obj"
|
4
|
+
require "reactor/plans/create_obj_class"
|
5
|
+
require "reactor/plans/delete_obj_class"
|
6
|
+
require "reactor/plans/update_obj_class"
|
7
|
+
require "reactor/plans/rename_obj_class"
|
8
|
+
require "reactor/plans/create_attribute"
|
9
|
+
require "reactor/plans/delete_attribute"
|
10
|
+
require "reactor/plans/update_attribute"
|
11
|
+
require "reactor/plans/create_attribute_group"
|
12
|
+
require "reactor/plans/delete_attribute_group"
|
13
|
+
require "reactor/plans/update_attribute_group"
|
14
|
+
require "reactor/plans/create_group"
|
15
|
+
require "reactor/plans/update_group"
|
16
|
+
require "reactor/plans/delete_group"
|
17
|
+
require "reactor/plans/rename_group"
|
18
|
+
require "reactor/plans/create_channel"
|
19
|
+
require "reactor/plans/delete_channel"
|
20
|
+
require "reactor/plans/create_job"
|
21
|
+
require "reactor/plans/update_job"
|
22
|
+
require "reactor/plans/delete_job"
|
24
23
|
|
25
24
|
module Reactor
|
26
25
|
class Migration
|
27
26
|
METHODS = {
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
}
|
27
|
+
create_obj: Plans::CreateObj,
|
28
|
+
delete_obj: Plans::DeleteObj,
|
29
|
+
update_obj: Plans::UpdateObj,
|
30
|
+
create_class: Plans::CreateObjClass,
|
31
|
+
delete_class: Plans::DeleteObjClass,
|
32
|
+
update_class: Plans::UpdateObjClass,
|
33
|
+
rename_class: Plans::RenameObjClass,
|
34
|
+
create_attribute: Plans::CreateAttribute,
|
35
|
+
delete_attribute: Plans::DeleteAttribute,
|
36
|
+
update_attribute: Plans::UpdateAttribute,
|
37
|
+
create_attribute_group: Plans::CreateAttributeGroup,
|
38
|
+
delete_attribute_group: Plans::DeleteAttributeGroup,
|
39
|
+
update_attribute_group: Plans::UpdateAttributeGroup,
|
40
|
+
create_group: Plans::CreateGroup,
|
41
|
+
delete_group: Plans::DeleteGroup,
|
42
|
+
update_group: Plans::UpdateGroup,
|
43
|
+
rename_group: Plans::RenameGroup,
|
44
|
+
create_channel: Plans::CreateChannel,
|
45
|
+
delete_channel: Plans::DeleteChannel,
|
46
|
+
create_job: Plans::CreateJob,
|
47
|
+
delete_job: Plans::DeleteJob,
|
48
|
+
update_job: Plans::UpdateJob
|
49
|
+
}.freeze
|
51
50
|
|
52
51
|
def self.method_missing(name, *args, &block)
|
53
|
-
if METHODS.key? name.to_sym
|
54
|
-
instance = init(name
|
55
|
-
plan(instance
|
52
|
+
if METHODS.key? name.to_sym
|
53
|
+
instance = init(name, *args)
|
54
|
+
plan(instance, &block)
|
56
55
|
prepare(instance)
|
57
56
|
migrate(instance)
|
58
57
|
else
|
@@ -76,12 +75,11 @@ module Reactor
|
|
76
75
|
@contained || []
|
77
76
|
end
|
78
77
|
|
79
|
-
|
80
|
-
def self.init(name,*args)
|
78
|
+
def self.init(name, *args)
|
81
79
|
METHODS[name.to_sym].new(*args)
|
82
80
|
end
|
83
81
|
|
84
|
-
def self.plan(instance
|
82
|
+
def self.plan(instance, &block)
|
85
83
|
instance.instance_eval(&block) if block_given?
|
86
84
|
end
|
87
85
|
|
@@ -94,6 +92,7 @@ module Reactor
|
|
94
92
|
end
|
95
93
|
|
96
94
|
private
|
97
|
-
|
95
|
+
|
96
|
+
def initialize; end
|
98
97
|
end
|
99
98
|
end
|
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
class Reactor::NoWorkingVersion < StandardError ; end
|
1
|
+
class Reactor::NoWorkingVersion < StandardError; end
|
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
class Reactor::NotPermitted < StandardError ; end
|
1
|
+
class Reactor::NotPermitted < StandardError; end
|
data/lib/reactor/permission.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require 'reactor/cache/user'
|
1
|
+
require "reactor/session"
|
2
|
+
require "reactor/cache/permission"
|
3
|
+
require "reactor/cache/user"
|
5
4
|
|
6
5
|
module Reactor
|
7
|
-
|
8
6
|
# This module adds #permission method to obj that act as a gateway for permission checking,
|
9
7
|
# see documentation for [Permission::PermissionProxy] for more details.
|
10
8
|
# @see [Permission::PermissionProxy]
|
@@ -16,9 +14,7 @@ module Reactor
|
|
16
14
|
#
|
17
15
|
# Therefore if the user lacks permissions no futher actions are executed.
|
18
16
|
module Permission
|
19
|
-
|
20
17
|
module Base
|
21
|
-
|
22
18
|
# @see [PermissionProxy]
|
23
19
|
def permission
|
24
20
|
@permission ||= PermissionProxy.new(self)
|
@@ -29,7 +25,7 @@ module Reactor
|
|
29
25
|
# @raise [Reactor::NotPermitted] user lacks neccessary permission
|
30
26
|
def release!(*args)
|
31
27
|
ensure_permission_granted(:release)
|
32
|
-
|
28
|
+
super
|
33
29
|
end
|
34
30
|
|
35
31
|
# Wraps around Reactor::Persistence::Base#take! and ensures
|
@@ -37,7 +33,7 @@ module Reactor
|
|
37
33
|
# @raise [Reactor::NotPermitted] user lacks neccessary permission
|
38
34
|
def take!(*args)
|
39
35
|
ensure_permission_granted(:take)
|
40
|
-
|
36
|
+
super
|
41
37
|
end
|
42
38
|
|
43
39
|
# Wraps around Reactor::Persistence::Base#revert! and ensures
|
@@ -45,7 +41,7 @@ module Reactor
|
|
45
41
|
# @raise [Reactor::NotPermitted] user lacks neccessary permission
|
46
42
|
def revert!(*args)
|
47
43
|
ensure_permission_granted(:revert)
|
48
|
-
|
44
|
+
super
|
49
45
|
end
|
50
46
|
|
51
47
|
# Wraps around Reactor::Persistence::Base#edit! and ensures
|
@@ -53,7 +49,7 @@ module Reactor
|
|
53
49
|
# @raise [Reactor::NotPermitted] user lacks neccessary permission
|
54
50
|
def edit!(*args)
|
55
51
|
ensure_permission_granted(:edit)
|
56
|
-
|
52
|
+
super
|
57
53
|
end
|
58
54
|
|
59
55
|
# Wraps around ActiveRecord::Persistence#save and ensures
|
@@ -63,11 +59,11 @@ module Reactor
|
|
63
59
|
if persisted?
|
64
60
|
ensure_permission_granted(:write)
|
65
61
|
else
|
66
|
-
ensure_create_permission_granted(
|
62
|
+
ensure_create_permission_granted(parent_obj_id)
|
67
63
|
end
|
68
|
-
|
64
|
+
super
|
69
65
|
rescue Reactor::NotPermitted
|
70
|
-
|
66
|
+
false
|
71
67
|
end
|
72
68
|
|
73
69
|
# Wraps around ActiveRecord::Persistence#save! and ensures
|
@@ -77,9 +73,9 @@ module Reactor
|
|
77
73
|
if persisted?
|
78
74
|
ensure_permission_granted(:write)
|
79
75
|
else
|
80
|
-
ensure_create_permission_granted(
|
76
|
+
ensure_create_permission_granted(parent_obj_id)
|
81
77
|
end
|
82
|
-
|
78
|
+
super
|
83
79
|
end
|
84
80
|
|
85
81
|
# Wraps around Reactor::Persistence::Base#resolve_refs! and ensures
|
@@ -87,22 +83,29 @@ module Reactor
|
|
87
83
|
# @raise [Reactor::NotPermitted] user lacks neccessary permission
|
88
84
|
def resolve_refs!
|
89
85
|
ensure_permission_granted(:write)
|
90
|
-
|
86
|
+
super
|
91
87
|
end
|
92
88
|
|
93
89
|
private
|
94
90
|
|
95
91
|
def ensure_permission_granted(type)
|
96
|
-
|
97
|
-
|
92
|
+
unless permission.send("#{type}?")
|
93
|
+
raise Reactor::NotPermitted, "#{path} lacks neccessary permissions for #{type}"
|
94
|
+
end
|
95
|
+
|
96
|
+
true
|
98
97
|
end
|
99
98
|
|
100
99
|
def ensure_create_permission_granted(obj_id)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
unless RailsConnector::AbstractObj.exists?(obj_id)
|
101
|
+
raise "Permission check for object with id=#{obj_id.inspect} which does not exist"
|
102
|
+
end
|
103
|
+
unless RailsConnector::AbstractObj.find(obj_id).permission.create_children?
|
104
|
+
raise Reactor::NotPermitted, "Obj lacks neccessary permissions for creation"
|
105
|
+
end
|
105
106
|
|
107
|
+
true
|
108
|
+
end
|
106
109
|
end
|
107
110
|
|
108
111
|
# This class acts as a proxy to underlying permission checking classes.
|
@@ -111,7 +114,6 @@ module Reactor
|
|
111
114
|
# 2. Given user has the permission
|
112
115
|
# 3. Given user doesn't have the permission
|
113
116
|
class PermissionProxy
|
114
|
-
|
115
117
|
def initialize(obj) #:nodoc:
|
116
118
|
@obj = obj
|
117
119
|
@cache = Reactor::Cache::Permission.instance
|
@@ -119,7 +121,7 @@ module Reactor
|
|
119
121
|
end
|
120
122
|
|
121
123
|
# Returns true if given user (or current user, if none given) has 'live' permission
|
122
|
-
def live?(user=nil)
|
124
|
+
def live?(user = nil)
|
123
125
|
granted?(user, :live)
|
124
126
|
end
|
125
127
|
|
@@ -180,7 +182,7 @@ module Reactor
|
|
180
182
|
def set(permission, groups)
|
181
183
|
identifier = identifier(permission)
|
182
184
|
|
183
|
-
groups = [groups] if groups.
|
185
|
+
groups = [groups] if groups.is_a?(::String)
|
184
186
|
crul_obj.permission_set(identifier, groups)
|
185
187
|
end
|
186
188
|
|
@@ -189,7 +191,7 @@ module Reactor
|
|
189
191
|
def grant(permission, groups)
|
190
192
|
identifier = identifier(permission)
|
191
193
|
|
192
|
-
groups = [groups] if groups.
|
194
|
+
groups = [groups] if groups.is_a?(::String)
|
193
195
|
crul_obj.permission_grant(identifier, groups)
|
194
196
|
end
|
195
197
|
|
@@ -198,7 +200,7 @@ module Reactor
|
|
198
200
|
def revoke(permission, groups)
|
199
201
|
identifier = identifier(permission)
|
200
202
|
|
201
|
-
groups = [groups] if groups.
|
203
|
+
groups = [groups] if groups.is_a?(::String)
|
202
204
|
crul_obj.permission_revoke(identifier, groups)
|
203
205
|
end
|
204
206
|
|
@@ -228,7 +230,7 @@ module Reactor
|
|
228
230
|
end
|
229
231
|
rescue Reactor::Cm::MissingCredentials
|
230
232
|
raise
|
231
|
-
rescue => e
|
233
|
+
rescue StandardError => e
|
232
234
|
Rails.logger.error("Error looking up #{user}'s permission for #{permission} operation on #{obj.path} :\n#{e.message}")
|
233
235
|
false
|
234
236
|
end
|
@@ -236,11 +238,11 @@ module Reactor
|
|
236
238
|
# A table with all available permissions and their identifier.
|
237
239
|
def self.permissions
|
238
240
|
@permissions ||= {
|
239
|
-
:
|
240
|
-
:
|
241
|
-
:
|
242
|
-
:
|
243
|
-
:
|
241
|
+
read: "permissionRead",
|
242
|
+
root: "permissionRoot",
|
243
|
+
live: "permissionLiveServerRead",
|
244
|
+
write: "permissionWrite",
|
245
|
+
create_children: "permissionCreateChildren"
|
244
246
|
}
|
245
247
|
end
|
246
248
|
|
@@ -263,7 +265,6 @@ module Reactor
|
|
263
265
|
end
|
264
266
|
|
265
267
|
class PermissionLookup
|
266
|
-
|
267
268
|
def initialize(obj)
|
268
269
|
@obj = obj
|
269
270
|
@cache = Reactor::Cache::User.instance
|
@@ -290,9 +291,6 @@ module Reactor
|
|
290
291
|
def user_in_groups(user, groups)
|
291
292
|
groups(user).detect { |user_group| groups.include?(user_group) } != nil
|
292
293
|
end
|
293
|
-
|
294
294
|
end
|
295
|
-
|
296
295
|
end
|
297
|
-
|
298
296
|
end
|