Class: Banzai::Filter::ReferenceRedactorFilter

Inherits:
HTML::Pipeline::Filter
  • Object
show all
Defined in:
lib/banzai/filter/reference_redactor_filter.rb

Overview

HTML filter that removes references to records that the current user does not have permission to view.

Expected to be run in its own post-processing pipeline.

Instance Method Summary collapse

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
# File 'lib/banzai/filter/reference_redactor_filter.rb', line 11

def call
  unless context[:skip_redaction]
    redactor_context = RenderContext.new(project, current_user)

    ReferenceRedactor.new(redactor_context).redact([doc])
  end

  doc
end