Question

I need to apply different record rules on same object to give different access rights depending on state that record is. For example there are three stages: stage1, stage2, stage3.

On first stage user with specific access rights group can do this:

Read, Write, Create his own records. When he presses button to go to stage2, then he can only Read that record (if that record would go back to stage1 - not by that user, then he could do previous things). And on stage3 that user does not see any records nor his nor any others.

I tried doing something like this:

First rule (applies r,w,c):

[('user_id','=',user.id)]

This one works. But I get problems when going to other stages. I tried to create another rule2 (applies r):

[('stage','=','stage2')] But it does not work, that user can still do anything that he can do in stage1.

If I make rule like this (applies r,w,c):

['|', ('user_id','=',user.id),('stage','=','stage1')]

Then it gives access rights error that you can't go to next stage, because you don't have read access rights on that stage. How can this be solved?..

Was it helpful?

Solution

It seems this one works:

Needed to create two rules (applies r,w,c):

['&', ('user_id','=',user.id),('state','=','stage1')]

And second rule (applies r):

[('stage','=','stage2')]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top