Getting an authenticated user out of context
I also just posted this to the ExUserFolder list, but I realise it's not necessarily specific to that. *** Bit of a newbie here, so my statements may be in error... Here's an outline of my site: Root Folder acl_users ... subfolder acl_users (exUserFolder) ... protected, lower stuff If a browser navigates to the root of my site, they are anonymous (with respect to the top level acl_users). If they login via a subfolder (having its own acl_users), they are authenticated in that subfolder and lower, etc. However, if they navigate back to the root, they are again anonymous (in that context), but returning to the subfolder, they are still authenticated. Q.1) Is it possible for pages at the root level to obtain the user info with respect to the subfolder's acl_users rather than that of the root's? I realise you can call methods on acl_users like this: <span tal:replace="python:root.acl_users.getUserNames()"></span> <span tal:replace="python:root.subfolder.acl_users.getUserNames()"></span> But, how do you discriminate between the 'authenticated user's that you're interested in? In other words, is there a way of getting a contextualised 'user' object? I can only think of calling a script that's located in 'subfolder', but I'm not sure that'd work... Q.2) Is the '__ac' cookie stored with respect to the path of the subfolder? Or when I need to log the 'subfolder' user out should the path in the following still be '/' or should it be '/subfolder/' ? <div tal:define="dummy python:request['RESPONSE'].expireCookie('__ac',path='/')" /> OR <div tal:define="dummy python:request['RESPONSE'].expireCookie('__ac',path='/subfolder/')" /> ta for help :)
Crosbie Fitch wrote at 2003-2-14 09:38 -0000:
... If a browser navigates to the root of my site, they are anonymous (with respect to the top level acl_users).
If they login via a subfolder (having its own acl_users), they are authenticated in that subfolder and lower, etc.
However, if they navigate back to the root, they are again anonymous (in that context), but returning to the subfolder, they are still authenticated.
Q.1) Is it possible for pages at the root level to obtain the user info with respect to the subfolder's acl_users rather than that of the root's? Zope authentication happens at the end of traversal, starting with the object reached during traversal. It goes back from this object until it find an "acl_users" that can authenticate the user with the required permissions.
You may be able to get user information from an "acl_users" in a deeper hierarchy in a high level object if you accesse it through the deeper hierarchy and it requires permissions not granted in the root "acl_users". However, I fear it will not work because Zope later explicitly restricts permissions to objects in the subhierarchy governed by the authenticating "acl_users" (for security reasons). An additional problem: When you are using HTTP authentication, the browser may not even send authentication information to higher hierarchy levels than that you have explicitely logged in. I do not have much hope for your wish.... Dieter
participants (2)
-
Crosbie Fitch -
Dieter Maurer