Re: [Maypole] Maypole::Plugin::Authorization

From: Josef Chladek (j.chladek at wirtschaftsblatt.at)
Date: Fri Jan 28 2005 - 16:23:27 GMT


Am 28.01.2005 um 13:03 schrieb Dave Howorth:

> Dave Howorth wrote:
>> Josef Chladek wrote:
>>> many thanks for that. i have one problem getting the two auxiliary
>>> methods
>>>
>>> get_authorized_classes
>>> get_authorized_methods
>>>
>>> to work. whenever i call them i get a scalar value as return value.
>>> what are the methods supposed to return and how could you use them? i
>>> thought when passing my $r they should return a list of allowed
>>> classes/methods, correct?
>> Hi Josef,
>> They were untested and evidently unfinished functions! As they stand,
>> they execute a DBI $sth and you need to retrieve the results from
>> that. You're quite right, it would be more useful if they returned a
>> list of classes/methods. I'll finish writing them and issue an
>> update.
>
> I've finished those methods and tidied the docs a bit and the result
> is attached.
>
> I do have a CPAN id now, but I still haven't written any tests. I'll
> post it to CPAN as soon as I've written them ...

thanks for the updates dave, there are two things:

1) in line 62 in Authorization.pm i had to add the following statement

     return unless $r->user;

otherwise i got

[error] Can't call method "id" on an undefined value at
/usr/local/share/perl/5.8.4/Maypole/Plugin/Authorization.pm line 62.

after a logout.

2) to use the ok_methods i wrote something like that:

ok_methods = request.get_authorized_methods
FOR meth = ok_methods;
     IF meth == "*";
        button(item, "edit");
        button(item, "delete");
     END;
END;

is that ok or was it meant to be used in an other way?

thanks
josef

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:58 GMT