[Zope] download file from LocalFS

2001-01-24 Thread Ulrich Wisser

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:

h1Path 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
   pmeta_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-53460905Fax: +46-8-534 609 06


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] download file from LocalFS

2001-01-24 Thread Jonothan Farr

 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?

I tried it like this:

dtml-call "RESPONSE.setHeader('content-type',mylfs.content_type)"
dtml-var mylfs

It mostly worked, except that my html documents were getting html-quoted. If you
can solve that I think you're home free.

--jfarr



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )