We would like to know if it is possible or if someone has been able to append some custom SQL to the queries generated by Mondrian.

We need to append, to all our queries, some security constraints in order to be able to restrict the data based on user rights.

Something like
FROM fact, dim1, dim2, %CUSTOM_TABLES%
WHERE fact.dim1_id = dim1.id and
     fact.dim2_id = dim2.id and
     %CUSTOM_SQL% -- for example a call to a db function with the user id as a parameter
We have tried to apply these security constraints by changing the mondrian model (by creating a DSP), but we couldn't achieve what we want.

Thanks for your help,