7 Feb 20:22
Re: Koala update
From: Hannes Mehnert <hannes <at> mehnert.org>
Subject: Re: Koala update
Newsgroups: gmane.comp.lang.dylan.gwydion.devel
Date: 2008-02-07 19:22:28 GMT
Subject: Re: Koala update
Newsgroups: gmane.comp.lang.dylan.gwydion.devel
Date: 2008-02-07 19:22:28 GMT
Bastian M?üller wrote:
> Hannes Mehnert wrote:
> > It is quite common that some parts are only accessible after a
> > successful authentication, that's why I would like to have the
> > possibility to express this directly in the map. So, my current
> > proposal for the macro would be:
>
> I understand what you mean and that's a good feature we should have, but
> the suggested "chain"-approach isn't perfect. What happens if an
> action returns false? The action chain stops and then the user gets a
> blank page. Maybe replacing the action sequence with normal control flow
> statements is a better solution,
>
>> define url-map
>> "/foo" ("\w/\w/\w") => bind-arguments; "foo.dsp",
>> ("") => "foo.dsp";
>> "/bar" ("\d/\d/\w") => authenticated-user?; bind-arguments; "bar.dsp";
>> "/foobar" () => admin-user?; foobar-responder;
>> "/barfoo" () => "barfoo.dsp";
>> end;
>
> "/foobar" () => if (admin-user?) foo-bar-responder else
> not-authenticated-responder end;
Actually, rethinking the authentication, I currently prefer that
admin-user? should signal an error (with not-authenticated-error or
similar) if the current logged in user is not an admin. So, no need for
if then else or to check whether a method returned #f.
Happy hacking,
Hannes
RSS Feed