Sha256: d1335afe1803bd81e9418c244cd3881a62ac47c1952d46d8d25586a65f9bcaff

Contents?: true

Size: 1.31 KB

Versions: 40

Compression:

Stored size: 1.31 KB

Contents

require 'rails_connector/cms_accessible'
require 'fiona7/editing_env_check'
require 'fiona7/access_permission_check'
require 'fiona7/in_editable_view'

module RailsConnector
  module CmsAccessible
    protected

    # changed to check live and read permissions
    def ensure_object_is_permitted
      begin 
        cms_user = rsession && rsession.user? && rsession.user
      # CM down, user not found, etc ~> no user
      rescue => e
        cms_user = false
      end

      unless Fiona7::AccessPermissionCheck.new(@obj, request.env, current_user, cms_user).read_permitted?
        @obj = nil
        render_obj_error(403, "forbidden")
        return false
      end
      return true
    end

    # allow unreleased objects in editing mode
    def ensure_object_is_active
      return true if Fiona7::EditingEnvCheck.new(request.env).rtc_selected?

      unless @obj.active?
        @valid_from = @obj.valid_from
        @valid_until = @obj.valid_until
        @obj = nil
        render_obj_error(410, "gone")
        return false
      end
      return true
    end

    include Fiona7::InEditableView

    def self.included(base)
      base.__send__(:helper_method, :is_permitted)
      base.__send__(:helper_method, :scrivito_in_editable_view?)
      base.__send__(:helper_method, :fiona7_in_editable_view?)
    end

  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
infopark_fiona7-1.2.0.0.0 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.9 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.8 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.7 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.6 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.5 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.4 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.3 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.2 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.10 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.1.0.0.0 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-0.71.1.9 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-0.71.1.8 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-0.71.1.7 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-0.71.1.6 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-0.71.1.5 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-0.71.1.12 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-0.71.1.11 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-0.71.1.10 lib/fiona7/fiona_connector_patches/cms_accessible.rb