[Zope] Document ownership

Markus Pietrek mpietrek@fsforth.de
Mon, 28 Jan 2002 15:24:50 +0100


Wow. I didn't knew that Jesus is already in the Internet. Perhaps I should go 
to church more often :-)

> I have a directory object where different users can add/store DTML
> Documents to it. I want to display only the files that belong to each user.
> If I log into the system as Jesus and go to that directory, i want to see
> only the files i created as myself.

I use this script to display a table where only the files owned by a user may 
be deleted by him.

  <dtml-in 
expr="restrictedTraverse(REQUEST.PATH_TRANSLATED).objectValues('Folder')">
   <dtml-call expr="REQUEST.set('otherOwner','')">
   <tr>
    <td>
     <dtml-with sequence-item>
      <dtml-if owner_info>
       <dtml-with owner_info mapping>
        <dtml-if expr="AUTHENTICATED_USER.getUserName() == id">
	 <dtml-comment>User is owner</dtml-comment>
         <dtml-call expr="REQUEST.set('ownsAnyFile',1)">
         <dtml-with sequence-item>
          <input type="checkbox" name="ids:list" value="&dtml-id;">
         </dtml-with>
	<dtml-else>
         <dtml-call expr="REQUEST.set('otherOwner',id)">
        </dtml-if>
       </dtml-with>
      </dtml-if>
     </dtml-with>
    </td>
    <td>
     <dtml-var expr="ZgetURLIcon(_['sequence-item'],'')">
    </td>
    <td><a href="&dtml-URL1;/&dtml-id;">&dtml-id;</a></td>
    <td><dtml-if expr="otherOwner != ''">
     owned by <a 
href="mailto:&dtml-otherOwner;">&dtml-otherOwner;</a></dtml-if>
    </td>
   </tr>
  <dtml-else>
   <tr><td><b>This folder doesn't contain any documents</b></td></tr>
  </dtml-in>
-- 

Markus Pietrek
FS FORTH-SYSTEME GmbH
Phone: +49 (7667) 908 145,  FAX +49 (7667) 908 221