← Back to team overview

openerp-expert-framework team mailing list archive

RFC: behaviour of ir.rule

 

Trying to prepare my "merging" code, I have stumbled on the ir.rule current 
implementation.

Let me remind you that we have "Rules" (as in the form and our understanding) 
and the ir.rule, ir.rule.group objects that implement it. Actually, it is 
ir.rule.group that maps to our "Rules". 

If you notice at the Rules form, it says "Rules are OR-ed together, lines are 
AND-ed". This is not true, since the trunk implementation ANDs all lines, 
accross all Rules. 

My question is: how do you use those Rules? Do you ever write multiple 
rules/lines per orm object?

IMHO, the right thing to do would be to AND ir.rule.groups together, while OR-
ing the ir.rules (=lines) inside each Rule. The OR operator would allow us to 
write simple expressions in each Rule (now, we do have many "['|',
(child_id,'=', 1),(child_id,'=',None)] " ). The idea is that Rules are 
"restrictive" as in /all restrictions must apply/, 
not 'permissive' as in /any rule can grant permission/.

Since the implementation is currently not documented right, it could be the 
right time, now, to reconsider.

Can you think of usage scenarios, where multiple rules must be combined 
together? What would these need in terms of the framework?

As a side-effect, the wording of the r/w/c/d boolean fields should change into 
something like "apply in r/w/c/d" rather than "Read permission".. It will help 
the users more.




Follow ups