infopark_fiona7 0.71.0.6 → 0.71.0.7

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: c14523518e257dd8aac6700eee128ff69aaa9741
4
- data.tar.gz: 693b82cb59011cac2c96c6b1c83a72d1967b761d
3
+ metadata.gz: 07728fd57fdb01877b58ba69bde489bc1e5e2508
4
+ data.tar.gz: bb716b43bd3cf4f5a2939f794386126315e488cc
5
5
  SHA512:
6
- metadata.gz: 311e175c753051f99eccf5bdb03d8abec2e0e6065b8a1111cad6d7fcb5c04747f231796b5e590f7a55e13f562b1e54bf3f585d5c3dad13e3af08b23dad8bdbd7
7
- data.tar.gz: 2a55154cf81b325cfd6e8395b411d4cd9674c971bce3e99fe6335bf92ada195ea2f1f639555bc7ce6f0a09448622a97578467709d7219650d0230c6fd7e21414
6
+ metadata.gz: eb53ab8dd8c92567f7939801f61cc715fe299273346294d801a81dabdf54d5387ab4899fb3978fabec66f0d4b9c266163d1d04c2742d69fa7d7511c187348125
7
+ data.tar.gz: 328d9ac70b382b59fdb1632859ae0a4f00f338f7aa25d33d5c0ace84346c5828298c20841cd8eaa57e6b34becc454a00f9a5b2ed94595ffbc10ae70c7f17e8f9
@@ -1,6 +1,9 @@
1
+ require 'fiona7/controller_helper'
2
+
1
3
  module Fiona7
2
4
  class BlobsController < ActionController::Base
3
5
  include Fiona7::BinaryHandling::DeliveryMixin
6
+ include Fiona7::ControllerHelper
4
7
  include RailsConnector::CmsAccessible
5
8
 
6
9
  before_filter :load_obj
@@ -45,7 +45,7 @@ module Fiona7OverrideHelper
45
45
  fiona_child = children_map[scrivito_child.id]
46
46
 
47
47
  next if fiona_child.suppressed? # suppress_export
48
- next if !scrivito_in_editable_view? && !fiona_child.active? # valid_from & valid_until
48
+ next if !Fiona7::EditingEnvCheck.new(request.env).rtc_selected? && !fiona_child.active? # valid_from & valid_until
49
49
 
50
50
  block.call(list, fiona_child)
51
51
  end
@@ -10,7 +10,7 @@ module Fiona7
10
10
  end
11
11
 
12
12
  def read_permitted?
13
- if editing?
13
+ if edited_contents_visible?
14
14
  read_permission_check
15
15
  else
16
16
  live_permission_check
@@ -20,8 +20,8 @@ module Fiona7
20
20
  protected
21
21
  attr_accessor :obj, :env, :rc_user, :reactor_user
22
22
 
23
- def editing?
24
- Fiona7::EditingEnvCheck.new(self.env).check?
23
+ def edited_contents_visible?
24
+ Fiona7::EditingEnvCheck.new(self.env).rtc_selected?
25
25
  end
26
26
 
27
27
  # this is very quick!
@@ -1,7 +1,11 @@
1
+ require 'scrivito/controller_helper'
1
2
  require 'fiona7/in_editable_view'
3
+ require 'fiona7/current_user_map'
2
4
 
3
5
  module Fiona7
4
6
  module ControllerHelper
7
+ include Scrivito::ControllerHelper
8
+ include Fiona7::CurrentUserMap
5
9
  include InEditableView
6
10
 
7
11
  def self.included(base)
@@ -0,0 +1,20 @@
1
+ module Fiona7
2
+ module CurrentUserMapHelper
3
+ def self.groups_for_user(user)
4
+ user_name = user.id rescue ""
5
+ Reactor::Cache::User.instance.get(user_name).groups
6
+ rescue => e
7
+ Rails.logger.error "Error occured reading user groups of #{user_name} (#{e.message})"
8
+ []
9
+ end
10
+ end
11
+
12
+ module CurrentUserMap
13
+ protected
14
+ def current_user
15
+ @current_user ||= OpenStruct.new({
16
+ :live_server_groups => CurrentUserMapHelper.groups_for_user(scrivito_user)
17
+ })
18
+ end
19
+ end
20
+ end
@@ -2,21 +2,32 @@ module Fiona7
2
2
  class EditingEnvCheck
3
3
  def initialize(env)
4
4
  self.env = env
5
+ self.editing_context = self.env[Scrivito::EditingContextMiddleware::ENVKEY]
5
6
  end
6
7
 
7
- def check?
8
- editing_context = self.env[Scrivito::EditingContextMiddleware::ENVKEY]
9
- editing_context && editing_context.authenticated_editor? && selected_workspace_id(editing_context) == 'rtc'
8
+ def rtc_selected?
9
+ editing_context && editing_context.authenticated_editor? && selected_workspace_id == 'rtc'
10
+ end
11
+
12
+ def editing_mode?
13
+ rtc_selected? && editing_context && editing_context.authenticated_editor? && selected_display_mode == 'editing'
10
14
  end
11
15
 
12
16
  protected
13
17
  attr_accessor :env
18
+ attr_accessor :editing_context
14
19
 
15
20
  private
16
- def selected_workspace_id(editing_context)
21
+ def selected_workspace_id
22
+ # NOTE: this does not require workspace lookup/load_obj
23
+ # and thus is potentially faster
24
+ self.editing_context.instance_variable_get(:@selected_workspace_id).to_s
25
+ end
26
+
27
+ def selected_display_mode
17
28
  # NOTE: this does not require workspace lookup/load_obj
18
29
  # and thus is potentially faster
19
- editing_context.instance_variable_get(:@selected_workspace_id).to_s
30
+ self.editing_context.instance_variable_get(:@display_mode).to_s
20
31
  end
21
32
  end
22
33
  end
data/lib/fiona7/engine.rb CHANGED
@@ -32,6 +32,7 @@ require "fiona7/scrivito_patches/cms_routing"
32
32
  require "fiona7/scrivito_patches/layout_tags"
33
33
  require "fiona7/scrivito_patches/link_parser"
34
34
  require "fiona7/scrivito_patches/migrator"
35
+ require "fiona7/scrivito_patches/obj_data_from_rest"
35
36
  require "fiona7/scrivito_patches/page_config"
36
37
  require "fiona7/scrivito_patches/type_computer"
37
38
  require "fiona7/scrivito_patches/workspace"
@@ -19,7 +19,7 @@ module RailsConnector
19
19
 
20
20
  # allow unreleased objects in editing mode
21
21
  def ensure_object_is_active
22
- return true if Fiona7::EditingEnvCheck.new(request.env).check?
22
+ return true if Fiona7::EditingEnvCheck.new(request.env).rtc_selected?
23
23
 
24
24
  unless @obj.active?
25
25
  @valid_from = @obj.valid_from
@@ -0,0 +1,30 @@
1
+ require 'scrivito/backend/obj_data_from_rest'
2
+
3
+ module Scrivito
4
+ module Backend
5
+ class ObjDataFromRest
6
+ private
7
+ # nil values for links are handled incorrectly
8
+ def legacy_compatible(value, type)
9
+ if type == "linklist"
10
+ value.map(&method(:legacy_link)).compact
11
+ elsif type == "link"
12
+ legacy_link(value)
13
+ else
14
+ value
15
+ end
16
+ end
17
+
18
+ # nil values for links are handled incorrectly
19
+ def legacy_link(link)
20
+ return nil unless link
21
+ return link unless link["obj_id"]
22
+
23
+ transformed = link.dup
24
+ transformed["destination"] = transformed.delete("obj_id")
25
+
26
+ transformed
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Fiona7
2
- VERSION = "0.71.0.6"
2
+ VERSION = "0.71.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona7
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.71.0.6
4
+ version: 0.71.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-02 00:00:00.000000000 Z
11
+ date: 2015-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -182,6 +182,7 @@ files:
182
182
  - lib/fiona7/controllers/rest_api/blob_controller.rb
183
183
  - lib/fiona7/controllers/rest_api/obj_controller.rb
184
184
  - lib/fiona7/controllers/rest_api/workspace_controller.rb
185
+ - lib/fiona7/current_user_map.rb
185
186
  - lib/fiona7/editing_env_check.rb
186
187
  - lib/fiona7/engine.rb
187
188
  - lib/fiona7/fiona_connector_patches/basic_obj.rb
@@ -227,6 +228,7 @@ files:
227
228
  - lib/fiona7/scrivito_patches/link_parser.rb
228
229
  - lib/fiona7/scrivito_patches/migrator.rb
229
230
  - lib/fiona7/scrivito_patches/obj_class.rb
231
+ - lib/fiona7/scrivito_patches/obj_data_from_rest.rb
230
232
  - lib/fiona7/scrivito_patches/page_config.rb
231
233
  - lib/fiona7/scrivito_patches/type_computer.rb
232
234
  - lib/fiona7/scrivito_patches/workspace.rb