Set References in sequence

Hi, in my application (admin1) creates an item. After the item is created three different users (user1,user2,user3) make edits on the item. Currently i’m using references to allow the (users1,2,3) access the item created by the (admin1) to make their respective edits.
In this way the users can access the item at anytime in no order.
I’m thinking of changing it and let it work such that the references will be in sequence.
Eg. item can only be available for user2 to select only when user1 has already completed his work on the item in that order.

You can use permissions in combination with state groups for this. The following is a somewhat contrived example, but it shows the use of can-read in combination with ||. The || separates two permission expressions. If the first expression can not be evaluated it switches to the second.

	'users': collection ['gebruiker'] {
		'gebruiker': text
	}
	'entries': collection ['entry'] {
		can-read: .'status'?'user 1' ^ >'user 1' || .'status'?'user 2' ^ >'user 2'

		'entry': text
		'user 1': text -> ^ .'users'[]
		'user 2': text -> ^ .'users'[]
		'status': stategroup (
			'user 1' { }
			'user 2' { }
		)
	}

1 Like