Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Prevent error documents from being oEmbedded.
Browse files Browse the repository at this point in the history
  • Loading branch information
knowtheory committed Nov 14, 2016
1 parent 0909b3e commit ad1e36c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/controllers/api_controller.rb
Expand Up @@ -235,19 +235,20 @@ def logger
private

def resource_embeddable?(resource_params)
resource_params and
resource_params.present? and
resource_params[:format] == 'html' and
resource_params[:id] and
(
(
%w[documents pages].include?(resource_params[:controller]) and
resource_params[:id] =~ DC::Validators::SLUG # and
# Document.accessible(nil, nil).exists?(resource_params[:id])
%w[documents pages].include?(resource_params[:controller])
and resource_params[:id] =~ DC::Validators::SLUG
and Document.unrestricted.exists?(resource_params[:id])
) or
(
resource_params[:controller] == "annotations" and
resource_params[:document_id] =~ DC::Validators::SLUG # and
# Annotation.accessible(nil).exists?(resource_params[:id])
resource_params[:controller] == "annotations"
and resource_params[:document_id] =~ DC::Validators::SLUG
and Document.unrestricted.exists?(resource_params[:document_id])
and Annotation.accessible(nil).exists?(resource_params[:id])
)
)
end
Expand Down

0 comments on commit ad1e36c

Please sign in to comment.