Ok, that is quite some information. I've been thinking about the
CloudSecurity too, but guessed it was not what i wanted, since also users
who are not logged in are allowed on the site. I'll have a deeper look at
it, see if it can be of any use for me. Funny thing, when I was writing my
message I expected the first thing to read was about CouldSecurity ;P...
I'm still not sure how it will work with the named parameters, but at least
I know where to look now. I'll read the sourcecode of
org.mmbase.security.implementation.cloudcontext.builders.Contexts tomorrow
when I get back to work. Though, when in the meantime somebody else might
come up with more clearifications I can do something with: that'd be cool !
Thanks (a lot) for now,
Wouter
On woensdag 4 februari 2004 17:09 Michiel Meeuwissen told the
butterflies:
> Wouter van Vliet <[EMAIL PROTECTED]> wrote:
> > - I'm trying stuff with my vmUsers builder, which has a classfile
> > entry of
> <classfile>com.medialab.builders.vMuseum.User</classfile> and
> > of course some fields that are of no interest for now
> > - Basically, there are three scenario's I want to call functions on
> > 1. To Login, with a function Login(String userName, String
> > passWord); returning one single node, either the User that matches
> > with the username and password or an empty one with some default
> > values. The website allows users not to be logged in, but will
> > tailor stuff for users who are logged in.
> > 2. To Logout, destroying the session .. this is a void
> > 3. registerLocation(Double longitude, Double lattitude); when
> > someody clicks on a map, this click is registered and a list of
> > vmLocations nodes will be returned for near Locations. Like "Het
> > Buitenhof", here in The Hague.
>
> First of all, perhaps you might want a security
> implemetentation rather than functions. Look e.g. to 'cloud
> context security implementation'.
>
> > (from now on, "probably" is assumed untill stated otherwise)
> >
> > For scenario one, I was guessing that <mm:listnodefunction> would be
> > the best approach, returning a list of just one vmUsers object. Now,
> > since Michiel suggested me to use <mm:functioncontainer> to handle
> > parameters and return values. I was guessing something like:
> >
> > <mm:functioncontainer>
> > <mm:param value="username" />
> > <mm:param value="password" />
> > <mm:nodelistfunction name="Login">
> > // and here my user would exist
> > </mm:nodelistfunction>
> > </mm:functioncontainer
> >
> > But that doesn't work, resulting in
> >
> > org.apache.jasper.JasperException:
> /vmtesting/User.jsp(7,2) According
> > to the TLD attribute name is mandatory for tag param
> >
> > and a stacktrace on my screen.
>
> Yes, 'parameters' are named, so only giving a 'value' does
> not work. It could principally be added because parameters
> have position too, but we started out a bit strictly.
>
> >
> > Now, the question basically comes down to: what should I do to get
> > it working? As you might have guessed, I'm trying to use no java
> > code in my .jsp files at all.
>
> As of now the 'function' framework is only useable if you
> 'define' the function's parameters too.
>
> This can be done like this (taken from
> org.mmbase.security.implementation.cloudcontext.builders.Contexts)
>
> Implement a method:
> public Parameter[] getParameterDefinition(String function);
>
> e.g. like this (which is based on reflection):
>
> public Parameter[] getParameterDefinition(String function) {
> Parameter[] params =
>
> org.mmbase.util.functions.NodeFunction.getParametersByReflecti
> on(Users.class, function); if (params == null) return
> super.getParameterDefinition(function);
> return params;
>
> }
>
> and define the parameters like this then (will be used by given
> impl.): public final static Parameter[] GRANT_PARAMETERS = {
> new Parameter("grouporuser", String.class),
> PARAMETER_OPERATION, Parameter.USER
> };
>
>
> Then you could call your login function like this:
>
> <mm:functioncontainer>
> <mm:param name="username" value="admin" />
> <mm:param name="password" value="admin2k" />
> <mm:nodelistfunction name="login">
> bla bla
> </mm:nodelistfunction>
> </mm:functioncontainer>
>
> or perhaps a bit more short-handedly:
>
> <mm:import externid="username" from="parameters" />
> <mm:import externid="password" from="parameters" />
>
> <mm:nodelistfunction referids="username,password" name="login"> bla
> bla </mm:nodelistfunction>
>
>
> Michiel