infopark_reactor 1.22.5 → 1.22.6

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: 3a9e143ee816eacbc2f0432347dda891a0f6484f
4
- data.tar.gz: 87aab58e69637be98ca5ff72dcb3a5646276072a
3
+ metadata.gz: 411243dbe16d77f7eb90a4db5971c1311a4d5572
4
+ data.tar.gz: 9a78a8c682728552b701b6c9fec5f1de1d23adf1
5
5
  SHA512:
6
- metadata.gz: 75f268a458653f8d8233f76654fe8200df705b3c4f769b1f6085675439b02add96ad945a5d2f3b063b1f61967e0efbd6b533f1e2f83d2734d63c7c8d1c6feeaf
7
- data.tar.gz: ec9925bdc617d7bd897a8bbec323d462c8dc15517cf69f90597eed0163be4e15e0dba462e6a1902fa8cb7f7062c0e0bae1da82862fe3f1927cf3bfa35405eb78
6
+ metadata.gz: a0b887b0cc7e81fddada0d55e0d745401fe757f41fef3dc3d4f0f59a6a33d0016f2bd18fdced5cf26c9fc952497f300e93816c922d1f37180ee658737d94cfa9
7
+ data.tar.gz: e370727be51373b5f8a834805c99ca5d9b0f227cfb8e1dfe2bdfe9264c6c72759f554b95b23edd189509e09c192a2f0b5fd475143b85044b766fa3e9a623a7f6
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency 'rails', '>= 3.0.10', '< 4.3.0'
24
24
  #s.add_dependency 'infopark_rails_connector'
25
25
  s.add_dependency 'nokogiri'
26
- s.add_dependency 'term-ansicolor'
27
26
 
28
27
  s.add_development_dependency 'rspec'
29
28
  s.add_development_dependency 'yard'
@@ -166,8 +166,13 @@ module Reactor
166
166
  # Returns true if given user has permissions required to release an object (the exact
167
167
  # permissions depend on the state of the object)
168
168
  def release?(user = nil)
169
- (has_workflow? && root?(user)) || (!has_workflow? && write?(user))
170
- write?(user) || root?(user)
169
+ if !has_workflow?
170
+ # NOTE: order matters for speed
171
+ write?(user) || root?(user)
172
+ else
173
+ # this is slow
174
+ root?(user) || (has_workflow_api? && obj.workflow.release?)
175
+ end
171
176
  end
172
177
 
173
178
  # Setter to overwrite the current groups for the given +permission+ with the
@@ -243,11 +248,18 @@ module Reactor
243
248
  self.class.permissions[permission]
244
249
  end
245
250
 
251
+ # NOTE: this method may lie, when:
252
+ # - object received workflow and the cached state says otherwise
253
+ # - the workflow api is deactivated
246
254
  def has_workflow?
247
255
  cache.lookup(:any, "#{obj.path}:workflow") do
248
- RailsConnector::ObjectWithMetaData.find_by_object_id(obj.id).try(:workflow_name).present?
256
+ obj.workflow_name.present?
249
257
  end
250
258
  end
259
+
260
+ def has_workflow_api?
261
+ obj.class < Reactor::Workflow::Base
262
+ end
251
263
  end
252
264
 
253
265
  class PermissionLookup
@@ -1,11 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'nokogiri'
3
- require 'term/ansicolor'
4
3
 
5
4
  class SmartXmlLogger
6
5
 
7
- include Term::ANSIColor
8
-
9
6
  def initialize(forward_to, method = nil)
10
7
  @logger = forward_to
11
8
  @method = method
@@ -47,13 +44,13 @@ class SmartXmlLogger
47
44
 
48
45
  out = ' ' * indent
49
46
 
50
- attrs = node.attributes.values.map{|attr| %|#{attr.name}="#{red(attr.value)}"|}.join(' ')
47
+ attrs = node.attributes.values.map{|attr| %|#{attr.name}="#{(attr.value)}"|}.join(' ')
51
48
  attrs = " #{attrs}" if attrs.present?
52
49
 
53
- out << "<#{green(node.name)}#{attrs}#{'/' if empty}>"
50
+ out << "<#{(node.name)}#{attrs}#{'/' if empty}>"
54
51
 
55
52
  if has_text
56
- out << "#{red(node.text)}"
53
+ out << "#{(node.text)}"
57
54
  else
58
55
  out << "\n"
59
56
  end
@@ -63,7 +60,7 @@ class SmartXmlLogger
63
60
  end
64
61
 
65
62
  out << ' ' * indent unless has_text || empty
66
- out << "</#{green(node.name)}>\n" unless empty
63
+ out << "</#{(node.name)}>\n" unless empty
67
64
  out
68
65
  end
69
66
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Reactor
3
- VERSION = "1.22.5"
3
+ VERSION = "1.22.6"
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.22.5
4
+ version: 1.22.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-16 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -44,20 +44,6 @@ dependencies:
44
44
  - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
- - !ruby/object:Gem::Dependency
48
- name: term-ansicolor
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - '>='
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
47
  - !ruby/object:Gem::Dependency
62
48
  name: rspec
63
49
  requirement: !ruby/object:Gem::Requirement