infopark_reactor 1.7.2 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,6 +40,14 @@ module Reactor
40
40
  return super
41
41
  end
42
42
 
43
+ # Wraps around Reactor::Persistence::Base#revert! and ensures
44
+ # that current user has required permissions to revert the object
45
+ # @raise [Reactor::NotPermitted] user lacks neccessary permission
46
+ def revert!
47
+ ensure_permission_granted(:revert)
48
+ return super
49
+ end
50
+
43
51
  # Wraps around Reactor::Persistence::Base#edit! and ensures
44
52
  # that current user has required permissions to edit the object
45
53
  # @raise [Reactor::NotPermitted] user lacks neccessary permission
@@ -145,6 +153,11 @@ module Reactor
145
153
  write?(user)
146
154
  end
147
155
 
156
+ # @see #write?
157
+ def revert?(user = nil)
158
+ write?(user)
159
+ end
160
+
148
161
  # @see #write?
149
162
  def edit?(user = nil)
150
163
  write?(user)
@@ -34,6 +34,23 @@ module Reactor
34
34
  return false
35
35
  end
36
36
 
37
+ # Removes the working version of the object,
38
+ # if it exists
39
+ # @return [true]
40
+ def revert
41
+ return revert!
42
+ end
43
+
44
+ # Removes the working version of the object,
45
+ # if it exists
46
+ # @return [true]
47
+ # @note There is no difference between #revert and #revert!
48
+ def revert!
49
+ crul_obj.revert!
50
+ reload
51
+ return true
52
+ end
53
+
37
54
  # Releases the object. Returns true on succes, can raise exceptions
38
55
  # @raise [Reactor::AlreadyReleased]
39
56
  # @raise [ActiveRecord::RecordInvalid] validations failed
@@ -157,7 +174,7 @@ module Reactor
157
174
  clear_aggregation_cache
158
175
  clear_association_cache
159
176
  fresh_object = Obj.find(self.id, options)
160
- @attributes.update(fresh_object.instance_variable_get('@attributes'))
177
+ @attributes = fresh_object.instance_variable_get('@attributes')
161
178
  @attributes_cache = {}
162
179
  # RC reload
163
180
  @attr_values = nil
@@ -309,7 +326,8 @@ module Reactor
309
326
  end
310
327
 
311
328
  def crul_obj
312
- @crul_obj ||= Reactor::Cm::Obj.get(obj_id)
329
+ #@crul_obj ||= Reactor::Cm::Obj.get(obj_id)
330
+ @crul_obj ||= Reactor::Cm::Obj.load(obj_id)
313
331
  end
314
332
 
315
333
  def crul_obj_delete
@@ -457,7 +475,6 @@ module Reactor
457
475
  end
458
476
 
459
477
  instance = self.create!(attributes)# do |instance|
460
- #debugger
461
478
  instance.upload(data_or_io, extension)
462
479
  instance.save!
463
480
  #end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Reactor
3
- VERSION = "1.7.2"
3
+ VERSION = "1.8.0"
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_reactor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 7
9
- - 2
10
- version: 1.7.2
8
+ - 8
9
+ - 0
10
+ version: 1.8.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tomasz Przedmojski
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-03-14 00:00:00 +01:00
18
+ date: 2013-03-25 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency