Re: [Zope3-Users] Permission problem on adapter

2007-02-11 Thread FB
Hi,

On Sun, Feb 11, 2007 at 01:16:51AM +0100, Dominique Lederer wrote:
 hi
 
 i created a trusted adapter on a content object.
 then i created a formlib edit page for the ZMI, to be able to edit the
 new attributes on the adapted content object. the adapters interface is
 correctly rendered to the form.
 
 if i try to edit, an unauthorized error is shown, which i also get, when
 i register the user as Site Manager via Grant in the ZMI.
 The global admin *can* edit the adapters attributes (the one which is
 set globally via ZCML).
 
 i registered the adapter like this:
 adapter factory=.MyClassAnnotations
  trusted=true  /

Try to add the attribute 'locate=true' to the adapter-statement.

Regards,

Frank
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Permission problem on adapter

2007-02-11 Thread Dominique Lederer
FB schrieb:
 Hi,
 
 On Sun, Feb 11, 2007 at 01:16:51AM +0100, Dominique Lederer wrote:
 hi

 i created a trusted adapter on a content object.
 then i created a formlib edit page for the ZMI, to be able to edit the
 new attributes on the adapted content object. the adapters interface is
 correctly rendered to the form.

 if i try to edit, an unauthorized error is shown, which i also get, when
 i register the user as Site Manager via Grant in the ZMI.
 The global admin *can* edit the adapters attributes (the one which is
 set globally via ZCML).

 i registered the adapter like this:
 adapter factory=.MyClassAnnotations
  trusted=true  /
 
 Try to add the attribute 'locate=true' to the adapter-statement.

Thank you, that worked!

According to Philipps Book, locate should default to 'true', maybe a typo?

Regards Dom
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Permission problem on adapter

2007-02-11 Thread Marius Gedminas
On Sun, Feb 11, 2007 at 09:24:34AM +0100, FB wrote:
 On Sun, Feb 11, 2007 at 01:16:51AM +0100, Dominique Lederer wrote:
  i created a trusted adapter on a content object.
  then i created a formlib edit page for the ZMI, to be able to edit the
  new attributes on the adapted content object. the adapters interface is
  correctly rendered to the form.
  
  if i try to edit, an unauthorized error is shown, which i also get, when
  i register the user as Site Manager via Grant in the ZMI.
  The global admin *can* edit the adapters attributes (the one which is
  set globally via ZCML).

For future reference, when you get into a situation when the global
manager can do something, but a local manager cannot, know what you have
a broken __parent__ chain somewhere.  Every object that has security
declarations and can be security proxied must have a valid __parent__
chain leading to the ZODB root, or you will have problems like this.

  i registered the adapter like this:
  adapter factory=.MyClassAnnotations
   trusted=true  /
 
 Try to add the attribute 'locate=true' to the adapter-statement.

Cool, I didn't know about that one.  I'd've suggested setting the
adapter's __parent__ manually in the constructor.

Marius Gedminas
-- 
Where do you think you're going today?


signature.asc
Description: Digital signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Permission problem on adapter

2007-02-10 Thread Dominique Lederer
hi

i created a trusted adapter on a content object.
then i created a formlib edit page for the ZMI, to be able to edit the
new attributes on the adapted content object. the adapters interface is
correctly rendered to the form.

if i try to edit, an unauthorized error is shown, which i also get, when
i register the user as Site Manager via Grant in the ZMI.
The global admin *can* edit the adapters attributes (the one which is
set globally via ZCML).

i registered the adapter like this:
adapter factory=.MyClassAnnotations
 trusted=true  /

class class=.MyClassAnnotations 
require
permission=zope.View
interface=.interfaces.IMyClassAnnotations /
require
permission=zope.ManageContent
set_schema=.interfaces.IMyClassAnnotations /
/class

i can surpress the error, if i change the set_schema permission to
zope.View. But i think that is just a bad workarround.

what am i missing?
thank you for your help.

traceback is:

Module zope.formlib.form, line 757, in __call__
self.update()
Module zope.formlib.form, line 738, in update
result = action.success(data)
Module zope.formlib.form, line 582, in success
return self.success_handler(self.form, self, data)
Module zope.formlib.form, line 795, in handle_edit_action
if applyChanges(self.context, self.form_fields, data, self.adapters):
Module zope.formlib.form, line 509, in applyChanges
field.set(adapter, newvalue)
Module zope.schema._bootstrapfields, line 183, in set
setattr(object, self.__name__, value)
Unauthorized: (pathto.MyClassAnnotations object at 0xa6e9ad2c,
'headline', 'zope.ManageContent')
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users