scrivito_sdk 1.2.0 → 1.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scrivito/blobs_controller.rb +5 -3
  3. data/app/controllers/scrivito/obj_class_controller.rb +58 -0
  4. data/app/controllers/scrivito/objs_controller.rb +1 -6
  5. data/app/controllers/scrivito/proxy/objs_controller.rb +34 -0
  6. data/app/controllers/scrivito/resolve_paths_controller.rb +21 -0
  7. data/app/controllers/scrivito/sessions_controller.rb +7 -0
  8. data/app/controllers/scrivito/webservice_controller.rb +11 -0
  9. data/app/controllers/scrivito/workspaces_controller.rb +7 -9
  10. data/app/helpers/scrivito_helper.rb +1 -1
  11. data/app/views/scrivito/obj_class/defaults.json.jbuilder +1 -0
  12. data/app/views/scrivito/proxy/index.json.jbuilder +1 -0
  13. data/app/views/scrivito/resolve_paths/resolve.json.jbuilder +1 -0
  14. data/app/views/scrivito/sessions/update.json.jbuilder +1 -0
  15. data/app/views/scrivito/ui/index.html.erb +1 -0
  16. data/app/views/scrivito/webservice/_workspace.json.jbuilder +0 -2
  17. data/config/ca-bundle.crt +55 -669
  18. data/config/precedence_routes.rb +7 -1
  19. data/lib/assets/images/scrivito/image_placeholder.gif +0 -0
  20. data/lib/assets/javascripts/scrivito_ui.js +6259 -3918
  21. data/lib/assets/stylesheets/scrivito.css +1 -1
  22. data/lib/assets/stylesheets/scrivito_ui.css +1 -1
  23. data/lib/scrivito/attribute_content.rb +43 -8
  24. data/lib/scrivito/attribute_deserializer.rb +11 -1
  25. data/lib/scrivito/attribute_serializer.rb +44 -8
  26. data/lib/scrivito/basic_obj.rb +3 -3
  27. data/lib/scrivito/binary.rb +17 -3
  28. data/lib/scrivito/binary_param_verifier.rb +2 -2
  29. data/lib/scrivito/client_attribute_serializer.rb +11 -1
  30. data/lib/scrivito/client_error.rb +1 -1
  31. data/lib/scrivito/cms_field_tag.rb +2 -0
  32. data/lib/scrivito/cms_rest_api.rb +6 -13
  33. data/lib/scrivito/{date_attribute.rb → date_conversion.rb} +2 -4
  34. data/lib/scrivito/float_conversion.rb +29 -0
  35. data/lib/scrivito/image_tag.rb +1 -1
  36. data/lib/scrivito/integer_conversion.rb +29 -0
  37. data/lib/scrivito/obj_params_parser.rb +1 -1
  38. data/lib/scrivito/obj_search_builder.rb +1 -1
  39. data/lib/scrivito/obj_search_enumerator.rb +19 -99
  40. data/lib/scrivito/obj_search_enumerator/facet_query.rb +105 -0
  41. data/lib/scrivito/page_config.rb +1 -0
  42. data/lib/scrivito/session.rb +23 -0
  43. data/lib/scrivito/task.rb +1 -1
  44. data/lib/scrivito/ui_config.rb +6 -0
  45. data/lib/scrivito/user.rb +4 -3
  46. data/lib/scrivito/user_definition.rb +7 -7
  47. data/lib/scrivito/workspace.rb +14 -3
  48. data/lib/scrivito/workspace_data.rb +5 -0
  49. metadata +18 -6
  50. data/lib/assets/images/scrivito/image_placeholder.png +0 -0
data/lib/scrivito/user.rb CHANGED
@@ -138,7 +138,8 @@ module Scrivito
138
138
  @suggest_users_proc = options[:suggest_users_proc]
139
139
  @restriction_set = options[:restriction_set]
140
140
 
141
- @explicit_rules.each_key { |rule| assert_valid_verb(rule.second) }
141
+ @explicit_rules.each { |rule| assert_valid_verb(rule.second) }
142
+ @explicit_rules_set = Set.new(@explicit_rules.map { |rule| rule.take(3) })
142
143
  end
143
144
 
144
145
  def can?(verb, workspace)
@@ -156,12 +157,12 @@ module Scrivito
156
157
 
157
158
  def can_always?(verb, subject)
158
159
  assert_valid_verb(verb)
159
- @explicit_rules.has_key?([:can_always, verb, subject])
160
+ @explicit_rules_set.include?([:always, verb, subject])
160
161
  end
161
162
 
162
163
  def can_never?(verb, subject)
163
164
  assert_valid_verb(verb)
164
- @explicit_rules.has_key?([:can_never, verb, subject])
165
+ @explicit_rules_set.include?([:never, verb, subject])
165
166
  end
166
167
 
167
168
  def owner_of?(workspace)
@@ -5,7 +5,7 @@ module Scrivito
5
5
  class UserDefinition
6
6
  def initialize(user_id)
7
7
  @user_id = user_id
8
- @explicit_rules = {}
8
+ @explicit_rules = []
9
9
  end
10
10
 
11
11
  #
@@ -39,8 +39,8 @@ module Scrivito
39
39
  # end
40
40
  #
41
41
  def can_always(verb, subject, message = nil)
42
- assert_no_conflict(:can_never, verb, subject)
43
- @explicit_rules[[:can_always, verb, subject]] = message
42
+ assert_no_conflict(:never, verb, subject)
43
+ @explicit_rules << [:always, verb, subject, message]
44
44
  end
45
45
 
46
46
  #
@@ -77,8 +77,8 @@ module Scrivito
77
77
  # end
78
78
  #
79
79
  def can_never(verb, subject, message = nil)
80
- assert_no_conflict(:can_always, verb, subject)
81
- @explicit_rules[[:can_never, verb, subject]] = message
80
+ assert_no_conflict(:always, verb, subject)
81
+ @explicit_rules << [:never, verb, subject, message]
82
82
  end
83
83
 
84
84
  #
@@ -88,7 +88,7 @@ module Scrivito
88
88
  # @api public
89
89
  #
90
90
  def is_admin!
91
- User::VERBS.each { |verb| @explicit_rules[[:can_always, verb, :workspace]] ||= nil }
91
+ @explicit_rules = User::VERBS.map { |verb| [:always, verb, :workspace, nil] }
92
92
  end
93
93
 
94
94
  #
@@ -217,7 +217,7 @@ module Scrivito
217
217
  end
218
218
 
219
219
  def assert_no_conflict(type, verb, subject)
220
- if @explicit_rules.has_key?([type, verb, subject])
220
+ if @explicit_rules.detect { |rule| rule.take(3) == [type, verb, subject] }
221
221
  raise ScrivitoError.new("Conflicting rules for verb '#{verb}' and subject '#{subject}'")
222
222
  end
223
223
  end
@@ -126,13 +126,22 @@ class Workspace
126
126
  end
127
127
 
128
128
  delegate :content_state_id, :base_content_state_id, :content_state,
129
- :base_revision_id, :base_content_state, to: :data
129
+ :base_revision_id, :auto_update?, :base_content_state, to: :data
130
130
 
131
131
  # Create a new workspace.
132
- # @example Create a workspace, providing its title:
133
- # Scrivito::Workspace.create(title: "Jane")
134
132
  # @api public
135
133
  # @param [Hash] attributes
134
+ # @option attributes [String] :title title of the workspace.
135
+ # @option attributes [Boolean] :auto_update Specifies whether changes published intermediately
136
+ # are applied automatically and instantly to the working copy. The default is +true+. Setting
137
+ # this option to +false+ requires {#rebase rebasing} the working copy (manually) to keep it up
138
+ # to date.
139
+ # @example Create a workspace, providing its title:
140
+ # Scrivito::Workspace.create(title: "Jane")
141
+ # @example Create a workspace, providing auto_update:
142
+ # # Workspace will not be updated until it is published.
143
+ # Scrivito::Workspace.create(auto_update: false)
144
+ #
136
145
  # @return [Scrivito::Workspace]
137
146
  def self.create(attributes)
138
147
  find(create_async(attributes).result['id'])
@@ -140,6 +149,7 @@ class Workspace
140
149
 
141
150
  def self.create_async(attributes)
142
151
  Task.new do
152
+ attributes = attributes.reverse_merge(auto_update: true)
143
153
  CmsRestApi.task_unaware_request(:post, 'workspaces', workspace: attributes)
144
154
  end
145
155
  end
@@ -239,6 +249,7 @@ class Workspace
239
249
 
240
250
  # Rebases the current workspace from the published content in order to integrate the changes
241
251
  # that were published in the meantime.
252
+ # @note This action is not required for auto-updated workspaces.
242
253
  # @api public
243
254
  def rebase
244
255
  rebase_async.result
@@ -22,6 +22,10 @@ module Scrivito
22
22
  @data["content_state_id"].present?
23
23
  end
24
24
 
25
+ def auto_update?
26
+ @data["auto_update"]
27
+ end
28
+
25
29
  def base_content_state_id
26
30
  @data["base_content_state_id"] or raise InternalError
27
31
  end
@@ -58,6 +62,7 @@ module Scrivito
58
62
  'base_revision_id' => base_revision_id,
59
63
  'base_content_state_id' => base_csid,
60
64
  'memberships' => memberships,
65
+ 'auto_update' => auto_update?,
61
66
  }
62
67
  end
63
68
  end
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: 1.2.0
4
+ version: 1.3.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infopark AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-14 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -177,7 +177,11 @@ files:
177
177
  - app/controllers/scrivito/completion_controller.rb
178
178
  - app/controllers/scrivito/default_cms_controller.rb
179
179
  - app/controllers/scrivito/legacy_redirect_controller.rb
180
+ - app/controllers/scrivito/obj_class_controller.rb
180
181
  - app/controllers/scrivito/objs_controller.rb
182
+ - app/controllers/scrivito/proxy/objs_controller.rb
183
+ - app/controllers/scrivito/resolve_paths_controller.rb
184
+ - app/controllers/scrivito/sessions_controller.rb
181
185
  - app/controllers/scrivito/tasks_controller.rb
182
186
  - app/controllers/scrivito/ui_controller.rb
183
187
  - app/controllers/scrivito/users_controller.rb
@@ -193,6 +197,7 @@ files:
193
197
  - app/views/scrivito/completion/suggest.json.jbuilder
194
198
  - app/views/scrivito/content_widget/show.html.erb
195
199
  - app/views/scrivito/fallback_thumbnail.html.erb
200
+ - app/views/scrivito/obj_class/defaults.json.jbuilder
196
201
  - app/views/scrivito/objs/binary_no_cache.json.jbuilder
197
202
  - app/views/scrivito/objs/destroy.json.jbuilder
198
203
  - app/views/scrivito/objs/is_outdated.json.jbuilder
@@ -208,6 +213,9 @@ files:
208
213
  - app/views/scrivito/objs/widget.json.jbuilder
209
214
  - app/views/scrivito/objs/widget_class_selection.json.jbuilder
210
215
  - app/views/scrivito/page_details.html.erb
216
+ - app/views/scrivito/proxy/index.json.jbuilder
217
+ - app/views/scrivito/resolve_paths/resolve.json.jbuilder
218
+ - app/views/scrivito/sessions/update.json.jbuilder
211
219
  - app/views/scrivito/tasks/show.json.jbuilder
212
220
  - app/views/scrivito/ui/index.html.erb
213
221
  - app/views/scrivito/users/suggest.json.jbuilder
@@ -228,7 +236,7 @@ files:
228
236
  - config/locales/en.scrivito.models.yml
229
237
  - config/precedence_routes.rb
230
238
  - config/routes.rb
231
- - lib/assets/images/scrivito/image_placeholder.png
239
+ - lib/assets/images/scrivito/image_placeholder.gif
232
240
  - lib/assets/images/scrivito/source_invalid.png
233
241
  - lib/assets/images/scrivito/source_too_large.png
234
242
  - lib/assets/images/scrivito/source_type_invalid.png
@@ -328,7 +336,7 @@ files:
328
336
  - lib/scrivito/controller_actions.rb
329
337
  - lib/scrivito/controller_helper.rb
330
338
  - lib/scrivito/controller_runtime.rb
331
- - lib/scrivito/date_attribute.rb
339
+ - lib/scrivito/date_conversion.rb
332
340
  - lib/scrivito/deprecation.rb
333
341
  - lib/scrivito/dialog_size_helper.rb
334
342
  - lib/scrivito/diff.rb
@@ -336,11 +344,13 @@ files:
336
344
  - lib/scrivito/editing_context_middleware.rb
337
345
  - lib/scrivito/errored_widget_tag.rb
338
346
  - lib/scrivito/errors.rb
347
+ - lib/scrivito/float_conversion.rb
339
348
  - lib/scrivito/future_binary.rb
340
349
  - lib/scrivito/gem_info.rb
341
350
  - lib/scrivito/generator_helper.rb
342
351
  - lib/scrivito/html_string.rb
343
352
  - lib/scrivito/image_tag.rb
353
+ - lib/scrivito/integer_conversion.rb
344
354
  - lib/scrivito/layout_tags.rb
345
355
  - lib/scrivito/link.rb
346
356
  - lib/scrivito/link_parser.rb
@@ -369,6 +379,7 @@ files:
369
379
  - lib/scrivito/obj_search_enumerator.rb
370
380
  - lib/scrivito/obj_search_enumerator/batch.rb
371
381
  - lib/scrivito/obj_search_enumerator/batch_iterator.rb
382
+ - lib/scrivito/obj_search_enumerator/facet_query.rb
372
383
  - lib/scrivito/obj_search_enumerator/query_executor.rb
373
384
  - lib/scrivito/obj_update_params_parser.rb
374
385
  - lib/scrivito/page_config.rb
@@ -381,6 +392,7 @@ files:
381
392
  - lib/scrivito/route.rb
382
393
  - lib/scrivito/routing_extensions.rb
383
394
  - lib/scrivito/sdk_engine.rb
395
+ - lib/scrivito/session.rb
384
396
  - lib/scrivito/string_tagging.rb
385
397
  - lib/scrivito/tag_renderer.rb
386
398
  - lib/scrivito/task.rb
@@ -416,9 +428,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
416
428
  version: 2.1.0
417
429
  required_rubygems_version: !ruby/object:Gem::Requirement
418
430
  requirements:
419
- - - ">="
431
+ - - ">"
420
432
  - !ruby/object:Gem::Version
421
- version: '0'
433
+ version: 1.3.1
422
434
  requirements: []
423
435
  rubyforge_project:
424
436
  rubygems_version: 2.4.5