1.1 --- a/WebStack/Adapters/Zope.py Sun Sep 19 17:12:06 2004 +0000
1.2 +++ b/WebStack/Adapters/Zope.py Sun Sep 19 17:12:23 2004 +0000
1.3 @@ -15,25 +15,30 @@
1.4
1.5 "A WebStack adapter product superclass."
1.6
1.7 - security = ClassSecurityInfo()
1.8 -
1.9 - def __init__(self, id, resource, authenticator=None):
1.10 + def __init__(self, id, resource, authenticator=None, permission=None):
1.11
1.12 """
1.13 Initialise with an 'id', a WebStack 'resource', and an optional
1.14 - 'authenticator'.
1.15 + 'authenticator'. The optional 'permission' is a Zope-related security
1.16 + identifier.
1.17 """
1.18
1.19 self.id = id
1.20 self.webstack_resource = resource
1.21 self.webstack_authenticator = authenticator
1.22 + self.security = ClassSecurityInfo()
1.23 +
1.24 + if authenticator is None:
1.25 + self.security.declarePublic("index_html")
1.26 + else:
1.27 + permission = permission or "View"
1.28 + self.security.declareProtected(permission, "index_html")
1.29
1.30 def __bobo_traverse__(self, request, entry_name):
1.31 if entry_name == "index_html":
1.32 return getattr(self, "index_html")
1.33 return self
1.34
1.35 - security.declarePublic("index_html")
1.36 def index_html(self, REQUEST=None):
1.37
1.38 """
1.39 @@ -49,8 +54,8 @@
1.40 if self.webstack_authenticator is None or self.webstack_authenticator.authenticate(trans):
1.41 self.webstack_resource.respond(trans)
1.42 else:
1.43 - trans.set_header_value("WWW-Authenticate", '%s realm="%s"' % (
1.44 - self.webstack_authenticator.get_auth_type(), self.webstack_authenticator.get_realm()))
1.45 + #trans.set_header_value("WWW-Authenticate", '%s realm="%s"' % (
1.46 + # self.webstack_authenticator.get_auth_type(), self.webstack_authenticator.get_realm()))
1.47 raise "Unauthorized"
1.48
1.49 trans.commit()