[Zope3-Users] Zope security and inheritance

Taurus5 Taurus.5 at web.de
Fri Feb 6 21:10:10 EST 2009


Hello,

I have some trouble with the zope security. I got ForbiddenAttribute 
Exception on sub-classes.

In example:
 >>>(Pdb) _b = BaseCls()
 >>>(Pdb) class SubCls( BaseCls ): pass
 >>>(Pdb) _s = SubCls()
so I got ForbiddenAttribute Exceptions for sub-classes:
 >>>(Pdb) canAccess( _b, 'items' )
 >>>True
 >>>(Pdb) canAccess( _s, 'items' )
 >>>*** ForbiddenAttribute: ('items',     ...
damned, have a look at the checker:
 >>>(Pdb) _checker = getChecker( ProxyFactory( _b ) )
 >>>(Pdb) len( _checker.get_permissions )
 >>>12
 >>>(Pdb) _checker = getChecker( ProxyFactory( _s ) )
 >>>(Pdb) len( _checker.get_permissions )
 >>>0
why i lost my permissions?
but checkPermission returns true:
 >>>(Pdb) checkPermission( 'Test.read', ProxyFactory(_b) )
 >>>True
 >>>(Pdb) checkPermission( 'Test.read', ProxyFactory(_s) )
 >>>True

...confusing...

What should I do to avoid ForbiddenAttribute Exceptions in this scenario?

Thx!


More information about the Zope3-users mailing list