GuardedFile HOWTO

Author: Ng Pheng Siong
Email:ngps@netmemetic.com
Date: 2003-06-16
Version: 1.1

Contents

GuardedFile

A GuardedFile is a Zope File that is accessible by proxy only.

When a GuardedFile is created, all acquired permissions are unset. A proxy role is created in its container with the sole permission "View".

When the GuardedFile is deleted, its associated proxy role is also removed.

In all other aspects a GuardedFile behaves exactly like a File.

Add A GuardedFile

In your local filesystem, create a file named agf with the following content:

And this is the guarded content.

In a Zope folder, select "GuardedFile" from the drop-down list of available object types in the "Contents" view of the folder and click the "Add" button.

For Id, enter "gf1". You may leave Title blank. For File, click on the "Browse" button and upload the file agf. This will create the GuardedFile gf1.

Back at the folder's "Contents" view, click on the GuardedFile gf1. This brings you to the "Edit" view of the GuardedFile. Change its content type to "text/plain".

Now go to the GuardedFile's "Security" view. Note the role proxy_for_gf1, which has the single permission "View".

Test The GuardedFile

Access the GuardedFile over the web anonymously: Zope will authenticate you before allowing you access. If you click "Cancel" at the authentication dialog box, Zope informs you that "you are not authorized to access this resource."

Add A GuardedFile Accessor

Return to the Zope folder containing the GuardedFile gf1.

In the folder, create a DTML Method called gf-view containing the following:

<dtml-var standard_html_header>

<p>
This DTML-Method has the proxy-role <em>proxy_for_gf1</em>.
Hence it is able to view the GuardedFile gf1.
</p>

<p>
<dtml-var gf1>
</p>

<dtml-var standard_html_footer>

Assign the proxy role proxy_for_gf1 to gf-view.

Test The GuardedFile Accessor

Access gf-view over the web anonymously. You should see the following output:

This DTML-Method has the proxy-role proxy_for_gf1.
Hence it is able to view the GuardedFile gf1.

And this is the guarded content.

Application

The GuardedFile product is intended to be used with ZSmime.

ZSmime enables Zope to generate S/MIME signed/encrypted messages; the signing private key should be stored as a GuardedFile.