26 lines
518 B
Ruby
26 lines
518 B
Ruby
module Banzai
|
|
module Filter
|
|
# 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.
|
|
#
|
|
class RedactorFilter < HTML::Pipeline::Filter
|
|
def call
|
|
Redactor.new(project, current_user).redact([doc])
|
|
|
|
doc
|
|
end
|
|
|
|
private
|
|
|
|
def current_user
|
|
context[:current_user]
|
|
end
|
|
|
|
def project
|
|
context[:project]
|
|
end
|
|
end
|
|
end
|
|
end
|