On 03/03/12 08:53 +0100, Albert Cervera i Areny wrote: > A Diumenge, 26 de febrer de 2012 19:25:45, Cédric Krier va escriure: > > On 26/02/12 17:46 +0000, [email protected] wrote: > > > Reviewers: , > > > > > > > > > > > > Please review this at http://codereview.tryton.org/256001/ > > > > > > Affected files: > > > M trytond/model/__init__.py > > > A trytond/model/workflow.py > > > > This is a first try. It will be good to discuss the design. > > I've been thinking about the design and I think we can make it more generic. > In fact, I think we can fully drop the "workflow" word and talk simply about > security or permissions. > > My proposal is to replace "@Workflow.transition('cancel')" with something > like > "@Security.check()" and let capabilities to be checked with "ir.rule.group" > or > something similar. > > So the security rule would need: > - A domain expression > - A group of users > - A model > - A function name > > So a function with the decorator of a given model can be executed if domain > expression and group match any of the existing rules.
So the only difference in terms of possibilities in your proposal is to use a full domain than just a fixed one based on the _transition_state field. Why not! But I find that the current limitation force developer to have a clean "workflow" for the users based on a simple field. Almost every time, I speak with users about workflow they speak in terms of state. What I really don't like is to reuse the ir.rule.group or any thing else stored in the database because the extension of something stored in the database is painful (this is the main purpose of this switch). -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgpcAlIiVw01X.pgp
Description: PGP signature
