Hi, I've had a couple of problems with SiteAccess. The first one appeared when I tried the sample code from the doc: <dtml-unless "REQUEST.path[0][:6]=='manage'"> ... This Access Rule is placed in some directory foo. If I try to access http://my.site.org/foo I get: Error Type: IndexError Error Value: list index out of range If I try http://my.site.org/foo/bar, there is no such problem. The second problem is the following: I am trying to set up siteaccess so that it checks for user authentification, and redirects to a login screen if necessary. That way, I am sure all authentification is cookie-based, and I don't get the ugly error page in case of failure. So I tried: <dtml-unless "REQUEST.path[0][:6]=='manage'"> <dtml-unless "AUTHENTICATED_USER.has_role('Member')"> redirect to login screen </dtml-unless> </dtml-unless> But then I get: Error Type: KeyError Error Value: AUTHENTICATED_USER Which is weird, because if I try to render the method normally, it works. I tried replacing <dtml-unless "AUTHENTICATED_USER.has_role('Member')"> by <dtml-unless "AUTHENTICATED_USER"> And I get the same result. Last thing, I would like to be able to set the path to the login screen ('foo/login'). What is the most elegant way of doing that? I seem to also have permission problems when accessing methods like absolute_url() in the Access Rule. This might be related to the previous problem. Thanks a lot, Stefan.
----- Original Message ----- From: Stefan Langerman <lfalse@cs.rutgers.edu>
I've had a couple of problems with SiteAccess. The first one appeared when I tried the sample code from the doc:
<dtml-unless "REQUEST.path[0][:6]=='manage'"> ...
This Access Rule is placed in some directory foo. If I try to access http://my.site.org/foo I get: Error Type: IndexError Error Value: list index out of range If I try http://my.site.org/foo/bar, there is no such problem.
This is from the "Other Uses" page, right? In that example, it is an error to access the folder, since it is only meant to act as a placeholder for a session value. The IndexError occurs when the code tries to access the last element in the remaining path, but there *is* no remaining path!
<dtml-unless "REQUEST.path[0][:6]=='manage'"> <dtml-unless "AUTHENTICATED_USER.has_role('Member')"> redirect to login screen </dtml-unless> </dtml-unless>
Access Rules execute before any authentication takes place, so AUTHENTICATED_USER doesn't exist yet. This also prevents them from accessing any other Zope objects unless you give the Rule a Proxy role. It looks like you need GenericUserFolder or UserDB. Cheers, Evan @ 4-am & digicool
participants (2)
-
Evan Simpson -
Stefan Langerman