scrivito_sdk 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scrivito/default_cms_controller.rb +3 -3
  3. data/app/controllers/scrivito/objs_controller.rb +18 -7
  4. data/app/controllers/scrivito/webservice_controller.rb +13 -1
  5. data/app/controllers/scrivito/workspaces_controller.rb +5 -1
  6. data/app/helpers/scrivito/cms_asset_helper.rb +8 -1
  7. data/app/helpers/scrivito/default_cms_routing_helper.rb +2 -4
  8. data/app/helpers/scrivito/display_helper.rb +0 -7
  9. data/app/helpers/scrivito/editing_helper.rb +10 -8
  10. data/app/helpers/scrivito/layout_helper.rb +4 -11
  11. data/config/ca-bundle.crt +1773 -1416
  12. data/config/cms_routes.rb +2 -2
  13. data/config/routes.rb +1 -0
  14. data/lib/assets/javascripts/scrivito_editing.js +969 -533
  15. data/lib/assets/stylesheets/scrivito_editing.css +99 -9
  16. data/lib/generators/cms/migration/templates/migration.erb +34 -6
  17. data/lib/generators/cms/widget/templates/migration.erb +3 -6
  18. data/lib/scrivito/attribute.rb +158 -0
  19. data/lib/scrivito/attribute_collection.rb +72 -0
  20. data/lib/scrivito/attribute_content.rb +39 -3
  21. data/lib/scrivito/basic_obj.rb +48 -27
  22. data/lib/scrivito/basic_widget.rb +15 -5
  23. data/lib/scrivito/client_config.rb +46 -19
  24. data/lib/scrivito/cms_field_tag.rb +1 -1
  25. data/lib/scrivito/cms_rest_api/attribute_serializer.rb +6 -1
  26. data/lib/scrivito/cms_rest_api/blob_uploader.rb +1 -1
  27. data/lib/scrivito/configuration.rb +32 -2
  28. data/lib/scrivito/connection_manager.rb +1 -6
  29. data/lib/scrivito/content_conversion.rb +11 -7
  30. data/lib/scrivito/editing_context.rb +12 -0
  31. data/lib/scrivito/gem_info.rb +13 -0
  32. data/lib/scrivito/membership.rb +26 -0
  33. data/lib/scrivito/memberships_collection.rb +78 -0
  34. data/lib/scrivito/migrations/migration.rb +1 -1
  35. data/lib/scrivito/migrations/migration_dsl.rb +37 -0
  36. data/lib/scrivito/obj_class.rb +282 -0
  37. data/lib/scrivito/obj_data.rb +20 -1
  38. data/lib/scrivito/obj_params_parser.rb +2 -0
  39. data/lib/scrivito/obj_search_builder.rb +1 -1
  40. data/lib/scrivito/obj_search_enumerator.rb +11 -6
  41. data/lib/scrivito/objs_collection.rb +130 -0
  42. data/lib/scrivito/restriction_set.rb +54 -0
  43. data/lib/scrivito/user.rb +114 -0
  44. data/lib/scrivito/user_definition.rb +159 -0
  45. data/lib/scrivito/widget_garbage_collection.rb +4 -4
  46. data/lib/scrivito/workspace.rb +13 -78
  47. data/lib/scrivito/workspace_data_from_service.rb +2 -0
  48. metadata +15 -5
@@ -39,12 +39,12 @@ class WidgetGarbageCollection
39
39
 
40
40
  deleted_by_dereference = dereferenced - newreferenced
41
41
 
42
- recursivly_deleted = []
42
+ recursively_deleted = []
43
43
  deleted_by_dereference.each do |widget|
44
- recursivly_deleted += all_widgets_contained_in_except(widget, newreferenced)
44
+ recursively_deleted += all_widgets_contained_in_except(widget, newreferenced)
45
45
  end
46
46
 
47
- # we dont want to slow dont every request by scanning for orphans, so
47
+ # we dont want to slow down every request by scanning for orphans, so
48
48
  # we only do this when widgets are being deleted
49
49
  if deleted_by_dereference.present?
50
50
  orphans = @obj.all_widgets_from_pool - @obj.contained_widgets - newreferenced
@@ -52,7 +52,7 @@ class WidgetGarbageCollection
52
52
  orphans = []
53
53
  end
54
54
 
55
- deleted_by_dereference + recursivly_deleted + orphans
55
+ deleted_by_dereference + recursively_deleted + orphans
56
56
  end
57
57
 
58
58
  private
@@ -108,7 +108,7 @@ class Workspace
108
108
  # @api public
109
109
  def reload
110
110
  @workspace_data = CmsBackend.instance.find_workspace_data_by_id(self.id)
111
- @revision = @base_revision = nil
111
+ @revision = @base_revision = @memberships = nil
112
112
  end
113
113
 
114
114
  # Updates this workspace's attributes
@@ -162,6 +162,14 @@ class Workspace
162
162
  @workspace_data.title
163
163
  end
164
164
 
165
+ # @api beta
166
+ # Returns the members of this workspace and their roles
167
+ #
168
+ # @return [MembershipsCollection]
169
+ def memberships
170
+ @memberships ||= MembershipsCollection.new(self)
171
+ end
172
+
165
173
  def data
166
174
  @workspace_data
167
175
  end
@@ -201,52 +209,11 @@ class Workspace
201
209
  raise ScrivitoError, 'rtc workspace may contain attribute and class changes' if rtc?
202
210
  end
203
211
 
204
- # Find a {BasicObj Obj} by its id.
205
- # If the parameter is an Array containing ids, return a list of corresponding Objs.
206
- # @param [String, Integer, Array<String, Integer>]id_or_list
207
- # @return [Obj, Array<Obj>]
208
- # @api public
209
- def find_obj(id_or_list)
210
- find_filtering_deleted(id_or_list, false)
211
- end
212
-
213
- # Find a {BasicObj Obj} by its id.
214
- # If the parameter is an Array containing ids, return a list of corresponding Objs.
215
- # The results include deleted objects as well.
216
- # @param [String, Integer, Array<String, Integer>]id_or_list
217
- # @return [Obj, Array<Obj>]
218
- # @api public
219
- def find_obj_including_deleted(id_or_list)
220
- find_filtering_deleted(id_or_list, true)
221
- end
222
-
223
- # Find the {BasicObj Obj} with the given path.
224
- # Returns +nil+ if no matching Obj exists.
225
- # @param [String] path Path of the {BasicObj Obj}.
226
- # @return [Obj]
212
+ # {ObjsCollection} for this working copy
227
213
  # @api public
228
- def find_obj_by_path(path)
229
- find_objs_by(:path, [path]).first.first
230
- end
231
-
232
- # Returns the {BasicObj Obj} with the given permalink, or +nil+ if no matching Obj exists.
233
- # @param [String] permalink The permalink of the {BasicObj Obj}.
234
- # @return [Obj]
235
- # @api public
236
- def find_obj_by_permalink(permalink)
237
- find_objs_by(:permalink, [permalink]).first.first
238
- end
239
-
240
- def find_objs_by_parent_path(path)
241
- find_objs_by(:ppath, [path]).first
242
- end
243
-
244
- def find_obj_by_id(id)
245
- find_objs_by(:id, [id]).first.first
246
- end
247
-
248
- def find_objs_by_paths(paths)
249
- find_objs_by(:path, paths).map(&:first)
214
+ # @return {ObjsCollection}
215
+ def objs
216
+ @objs ||= ObjsCollection.new(self)
250
217
  end
251
218
 
252
219
  def inspect
@@ -255,38 +222,6 @@ class Workspace
255
222
 
256
223
  private
257
224
 
258
- def find_filtering_deleted(id_or_list, include_deleted)
259
- case id_or_list
260
- when Array
261
- find_objs_by(:id, id_or_list, include_deleted).map(&:first).compact
262
- else
263
- obj = find_objs_by(:id, [id_or_list.to_s], include_deleted).first.first
264
- obj or raise ResourceNotFound, "Could not find Obj with id #{id_or_list}"
265
- end
266
- end
267
-
268
- # accepts the name of an "obj_by" - view, a list of keys
269
- # and an "include_deleted" flag
270
- # returns a list of lists of Objs: a list of Objs for each given keys.
271
- def find_objs_by(view, keys, include_deleted = false)
272
- if include_deleted
273
- finder_method_name = :find_obj_data_including_deleted_by
274
- else
275
- finder_method_name = :find_obj_data_by
276
- end
277
-
278
- result = CmsBackend.instance.public_send(finder_method_name, revision, view, keys)
279
-
280
- result.map do |list|
281
- list.map do |obj_data|
282
- obj = BasicObj.instantiate(obj_data)
283
- obj.revision = revision
284
-
285
- obj
286
- end
287
- end
288
- end
289
-
290
225
  def backend_url
291
226
  "/workspaces/#{id}"
292
227
  end
@@ -24,6 +24,7 @@ class WorkspaceDataFromService
24
24
  data_attr_reader :base_revision_id
25
25
  data_attr_reader :base_content_state_id
26
26
  data_attr_reader :diff
27
+ data_attr_reader :memberships
27
28
 
28
29
  def initialize(data)
29
30
  @data = data
@@ -68,6 +69,7 @@ class WorkspaceDataFromService
68
69
  'content_state_id' => content_state_id,
69
70
  'base_revision_id' => base_revision_id,
70
71
  'base_content_state_id' => base_content_state_id,
72
+ 'memberships' => memberships,
71
73
  }
72
74
  end
73
75
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infopark AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-11 00:00:00.000000000 Z
11
+ date: 2014-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 2.2.1
61
+ version: 3.1.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 2.2.1
68
+ version: 3.1.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rest-client
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -193,6 +193,8 @@ files:
193
193
  - lib/generators/cms/widget/widget_generator.rb
194
194
  - lib/obj.rb
195
195
  - lib/scrivito/access_denied.rb
196
+ - lib/scrivito/attribute.rb
197
+ - lib/scrivito/attribute_collection.rb
196
198
  - lib/scrivito/attribute_content.rb
197
199
  - lib/scrivito/backend_error.rb
198
200
  - lib/scrivito/basic_obj.rb
@@ -231,10 +233,13 @@ files:
231
233
  - lib/scrivito/editing_context_middleware.rb
232
234
  - lib/scrivito/engine.rb
233
235
  - lib/scrivito/errors.rb
236
+ - lib/scrivito/gem_info.rb
234
237
  - lib/scrivito/html_string.rb
235
238
  - lib/scrivito/link.rb
236
239
  - lib/scrivito/link_parser.rb
237
240
  - lib/scrivito/log_subscriber.rb
241
+ - lib/scrivito/membership.rb
242
+ - lib/scrivito/memberships_collection.rb
238
243
  - lib/scrivito/migration.rb
239
244
  - lib/scrivito/migrations.rb
240
245
  - lib/scrivito/migrations/cms_backend.rb
@@ -248,18 +253,23 @@ files:
248
253
  - lib/scrivito/modification.rb
249
254
  - lib/scrivito/named_link.rb
250
255
  - lib/scrivito/network_error.rb
256
+ - lib/scrivito/obj_class.rb
251
257
  - lib/scrivito/obj_data.rb
252
258
  - lib/scrivito/obj_data_from_hash.rb
253
259
  - lib/scrivito/obj_data_from_service.rb
254
260
  - lib/scrivito/obj_params_parser.rb
255
261
  - lib/scrivito/obj_search_builder.rb
256
262
  - lib/scrivito/obj_search_enumerator.rb
263
+ - lib/scrivito/objs_collection.rb
257
264
  - lib/scrivito/rate_limit_exceeded.rb
265
+ - lib/scrivito/restriction_set.rb
258
266
  - lib/scrivito/revision.rb
259
267
  - lib/scrivito/string_tagging.rb
260
268
  - lib/scrivito/text_link.rb
261
269
  - lib/scrivito/text_link_conversion.rb
262
270
  - lib/scrivito/type_computer.rb
271
+ - lib/scrivito/user.rb
272
+ - lib/scrivito/user_definition.rb
263
273
  - lib/scrivito/widget_field_params.rb
264
274
  - lib/scrivito/widget_garbage_collection.rb
265
275
  - lib/scrivito/workspace.rb
@@ -289,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
299
  version: '0'
290
300
  requirements: []
291
301
  rubyforge_project:
292
- rubygems_version: 2.0.14
302
+ rubygems_version: 2.2.2
293
303
  signing_key:
294
304
  specification_version: 4
295
305
  summary: SDK for the Scrivito CMS