[PEAK] peak.security: permissionFor problem
Radek Kanovsky
rk at dat.cz
Fri Feb 11 12:43:10 EST 2005
On Fri, Feb 11, 2005 at 11:13:57AM -0500, Phillip J. Eby wrote:
> I wish you could send me a reproducable case, I have lots of things I'd
> like to check.
I have finally succeeded. The attached code raises AM exception on my
computer. Code is as minimal as was possible and is very fragile.
RadekK
-----------------------------------------------------------------------
from peak.api import *
import peak.web.api
class MaterialNavig (binding.Component) :
binding.metadata(security.Anybody, nazev=security.Anybody)
class Bibliografie (object) :
binding.metadata(
security.Anybody,
autor = security.Anybody,
nazev = security.Anybody,
abstract = security.Anybody,
link = security.Anybody,
)
class Document (object) :
binding.metadata(
security.Anybody,
nazev = security.Anybody,
abstract = security.Anybody,
link = security.Anybody,
)
class MaterialRemesla (web.Decorator) :
remesla_list = binding.Make(list, security.Anybody)
class RemesloRemeslnici (web.Decorator) :
remeslnik_list = binding.Make(list, security.Anybody)
policy = web.InteractionPolicy()
obj = web.Location()
print policy.permissionFor(obj,'users')
obj = web.ResourceDirectory()
print policy.permissionFor(obj,'user_list.pwt')
obj = web.TemplateDocument()
print policy.permissionFor(obj,None)
obj = web.ResourceDirectory()
print policy.permissionFor(obj,'layout.pwt')
obj = web.TemplateDocument()
print policy.permissionFor(obj,None)
from peak.web.templates import Parameters
obj = Parameters(1,2)
print policy.permissionFor(obj,None)
obj = Parameters(1,2)
print policy.permissionFor(obj,None)
obj = web.Context('name', None, {})
try :
perm = policy.permissionFor(obj,'user')
except dispatch.AmbiguousMethod, am :
g = am.args[0]
assert len(g) == 3
assert g[0][0] is g[1][0] is g[2][0]
assert g[0][1] is g[1][1] is g[2][1]
raise
More information about the PEAK
mailing list