Tangui Achraf,

> I have Amavis 2.6.1 on a  ubuntu box, configured 2 MySQL policies for 2
> kind of users. and some default scores written into the config file.
> I'm trying to have scores loaded from MySQL DB, I configured two policies
> in the policy table each with a different set of scores.

By 'scores' I presume you mean the tag, tag2 and kill levels.

> The behavior that a want :
>  having the default values overwritten by those in the mysql,
> whatever these last are,

SQL lookup is done before statical lookups. If it returns
a defined value (not NULL), then no further lookups are done.
So yes, SQL overrides other settings, unless a field value is NULL.

> especially If some score in DB is disabled i.e undef value 
> or null I want it to replace the default one
> behavior that I have so far:
>  - if one of the policies in DB is applied then if one of its scores is
> NULL or undef , the default value is kept...

Right.

> I could have used a huge score to represent the undef but, I'm trying to do
> it in a clean way .
> Can anyone telll me if I'm doing it the right way, and what would be the
> best solution to get the DB policies overwrite the default one for whatever
> value.

I'm afraid there is no way to force an undef value from SQL and still prevent
fallback to statical lookups. Either use high (or low, as appropriate) values,
or keep lists of statical lookup tables (@*_maps) empty, so than an undef
from SQL will be kept as a final answer:

  @spam_tag_level_maps  = ();
  @spam_tag2_level_maps = ();
  @spam_kill_level_maps = ();

With some other fields in SQL policy a trick is to use an empty string
in the field (which is not NULL so it stops further lookups), but it
gets interpreted the same as undef. This trick unfortunately does not
apply to tag, tag2 and kill levels.

  Mark


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
AMaViS-user mailing list
[email protected] 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 
 AMaViS-HowTos:http://www.amavis.org/howto/ 

Reply via email to