<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi (tried sending this previously, but the mailing list seemed non-responsive &#8211; apologies if you get it more than once!),<o:p></o:p></p><p class=MsoNormal>I&#8217;m trying to allow access to thumbnails of non-public documents.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>I&#8217;ve already added a thumbnail_security option (all_public, small_public and none_public) to the documents, and the generated thumbnails now inherit a security based on this value.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>By default, when a request for a thumbnail is submitted e.g. <a href="http://repo.ac.uk/123/1.hassmallThumbnailVersion/filename.png">http://repo.ac.uk/123/1.hassmallThumbnailVersion/filename.png</a>, the HTTP response is based on the security of the parent document, not the thumbnail document.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>When the request is processed (in ~/archives/ARCHIVEID/cfg/cfg.d/security.pl), the $doc is the parent document.<o:p></o:p></p><p class=MsoNormal>$c-&gt;{can_request_view_document} = sub<o:p></o:p></p><p class=MsoNormal>{<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my( $doc, $r ) = @_;<o:p></o:p></p><p class=MsoNormal>&#8230;<o:p></o:p></p><p class=MsoNormal>}<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>The $r passed to can_request_view_document does contain the correct document in $r-&gt;pnotes-&gt;{dataobj}, but is there an elegant way of determining that the request is for a related-document?<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>This seems to work OK:<o:p></o:p></p><p class=MsoNormal>my $tn_doc =&nbsp; $r-&gt;pnotes-&gt;{dataobj};<o:p></o:p></p><p class=MsoNormal>if( defined $tn_doc &amp;&amp; $tn_doc-&gt;get_value( &quot;security&quot; ) eq &quot;public&quot; &amp;&amp; $status eq &quot;archive&quot; )<o:p></o:p></p><p class=MsoNormal>{<o:p></o:p></p><p class=MsoNormal>&nbsp; &nbsp;&nbsp;return( &#8220;ALLOW&#8221; );<o:p></o:p></p><p class=MsoNormal>} <o:p></o:p></p><p class=MsoNormal>but it feels a little &#8216;hacky&#8217;. Is there a better way to achieve this?<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Cheers,<o:p></o:p></p><p class=MsoNormal>John<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>