AZ805: A synced permission reads who asks
The sync index says who may read each row for every principal at once, as keys. A condition that reads who asks or the session (authz.uid(), authz.ctx(), current_user, current_setting()) holds for one person at a time, so the index can't hold it. Say it with a relation: owner : user = owner_id, then can view = owner.
Reported when the policy is compiled: rowstile check, the editor, rowstile dev.
The mistake
authz
app role app_user
type user = app.users
type doc = app.docs
can view = {owner_id = authz.uid()}
sync role sync_engine
sync app.docs : viewline 4: {owner_id = authz.uid()} (a condition of what is synced) reads authz.uid(): who asks, or the session. The sync index says who may read a row for every principal at once, so it can't hold a condition on who asks. Say it with a relation (owner : user = owner_id) [AZ805]Fixed
authz
app role app_user
type user = app.users
type doc = app.docs
owner : user = owner_id
can view = owner
sync role sync_engine
sync app.docs : view