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.6.1.1.5 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.6.1.1.1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.6.1.1.0 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.2.0.2.3 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.2.0.2.1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.2.0.2.2 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.5.5.1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.5.5.0 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.2.0.1.4 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.5.4.1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.5.4.0 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.2.0.1.3 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.5.3.1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.4.3.0 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.3.2.0 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.3.2.0.pre.beta1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.2.1.0.pre.beta1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.5.2.0.0 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.2.0.1.1 lib/fiona7/fiona_connector_patches/cms_accessible.rb
infopark_fiona7-1.2.0.0.1 lib/fiona7/fiona_connector_patches/cms_accessible.rb