[Zope] download file from LocalFS

Ulrich Wisser u.wisser@publisher.de
Wed, 24 Jan 2001 13:05:40 +0100


Hello,

my users are not allowed to access the whole LocalFS.
Therefor I setup a proxy method to check their access
rights. If they are allowed I would like to return
the file.

This is what I came up with:

1. Make the LocalFS accessible through PathHandler
2. The PathHandler DTML method checks the access rights
3. if a directory is accessed a listening is returned
    if a file is accessed the file is returned

Now pleasse see my code:

<h1>Path to handle <dtml-var path_to_handle></h1>
<dtml-let user="AUTHENTICATED_USER.getUserName()">
<dtml-if "user in lfs.fileIds()">
   <dtml-call "REQUEST.set('mylfs',lfs[user])">
   <dtml-in path_to_handle>
     <dtml-call "REQUEST.set('mylfs',mylfs[_['sequence-item']])">
   </dtml-in>
   <p>meta_type = <dtml-var "mylfs.meta_type"></p>
   <dtml-if "mylfs.meta_type != 'Local Directory'">
     THE FILE SHOULD BE RETURNED HERE!
   <dtml-else>
     HERE COMES THE DIRECTORY INDEX.
   </dtml-if>
<dtml-else>
     <dtml-raise type="No Access">
       No access granted.<br>
       User: <dtml-var AUTHENTICATED_USER>
     </dtml-raise>
</dtml-if>
</dtml-let>

When mylfs references a directory meta_type is 'Local Directory'
but if mylfs references a file meta_type is 'File'.

How can I let the user download the file?

Ulrich
-- 
Searchengine Know How  - Webpromotion - Optimization - Internal Search
World Wide Web Publisher, Ulrich Wisser, Odensvag 13, S-14571 Norsborg
http://www.publisher.de   Tel: +46-8-53460905    Fax: +46-8-534 609 06