debian-mirror-gitlab/lib/banzai/filter/redactor_filter.rb

27 lines
550 B
Ruby
Raw Normal View History

2015-12-23 02:04:40 +05:30
module Banzai
module Filter
2015-10-24 18:46:33 +05:30
# 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
2017-08-17 22:00:37 +05:30
Redactor.new(project, current_user).redact([doc]) unless context[:skip_redaction]
2015-10-24 18:46:33 +05:30
doc
end
private
def current_user
context[:current_user]
end
def project
context[:project]
end
2015-10-24 18:46:33 +05:30
end
end
end