Comment 3 for bug 467207

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote : Re: Feature request: Secure params biding

Hmm, that is a good idea! We can even extend the idea to have different type of binding depending on your profile.

So I should be able to do:

public class User extends Model {

     public String name;

     @Bind(profile = "us", format = "yyyy-dd-MM")
     @Bind(profile = "fr", format = "yyyy-MM-dd")
     public Date date;

}

and then in the controller:

public static void editMyProfile(@As("${Lang}") User user) {
    ...
}

So @Bind(profile="") could support a comma separated list as well. If not specified it would apply to all profiles.
The @Bind could also be set on the class level and support a @Bind(binder=MyBinder.class). That would be useful for custom binder. Same idea of profile applies there.

If we follow this, then I think that the @Bind(exclude = "bla") should probably be @Unbind(profile).

Ok that's more work but we could do a lot of things with that. In case no @As is defined, the@Bind is ignored ad we fall back to the default date format. I will try to write a more elaborate functional specification (I believe the blueprints are made for that?).