[Zope3-Users] How to allow one user to access only his object

Naotoshi Seo sonots at sonots.com
Sat Oct 22 05:23:13 EDT 2005


Hi. It worked. interesting. I appreciate, TAHARA.

 > from zope.app.session.interfaces import ISession
 >
 > PACKAGE_NAME = 'your application name'
 >
 > class MessageEditView:
 >
 >     def __init__(self, context, request):
 >
 >         session = ISession(request)[PACKAGE_NAME]
 >
 >         password = request.get('password')
 >         if password is None:
 >             password = session.get('password')
 >
 >         message = getMessage(context, password) # please implement this:)
 >
 >         session['password'] = password
 >
 >         self.context = message # trick1
 >         self.request = request
 >         self._setUpWidgets()
 >
 > <editform
 >     label="Edit Message"
 >     name="edit.html"
 >     for="IMessageBoard"
 >     schema="IMessage"  <------ trick2
 >     class="MessageEditView"
 >     permission="zope.ManageContent"
 >     menu="zmi_views"
 >     title="Edit Message"
 >     />
 > """
 >




More information about the Zope3-users mailing list