# AZ807: A nested group the sync index can't hold

A group named as a subject (`team#member`) is a key in the sync index when who holds it is a union of what gives it: a principal in the group holds its key. When what gives it joins parts that depend on who asks with `and` or `not`, its holders are worked out as principals instead, which a group inside itself (`member : team#member`) would never finish. Say what gives the group without `and` / `not`, or sync a permission that doesn't read the group.

Reported when the policy is compiled: `rowstile check`, the editor, `rowstile dev`.

## The mistake

```authz
app role app_user
type user = app.users
type org = app.orgs
  member : user = app.org_members(org_id -> user_id)
  banned : user = app.org_bans(org_id -> user_id)
  can good = member and not banned
type team = app.teams
  member : user = app.team_members(team_id -> user_id)
  member : org#good = app.team_orgs(team_id -> org_id)
  member : team#member = app.teams(parent_id -> id)
type doc = app.docs
  team : team = team_id
  can view = team.member
sync role sync_engine
sync app.docs : view
```

```
line 8: team.member is a group in itself, and who holds it joins parts that depend on who asks with and / not: the sync index can't work it out as keys. Sync another permission, or say the group without and / not [AZ807]
```

## Fixed

```authz
app role app_user
type user = app.users
type org = app.orgs
  member : user = app.org_members(org_id -> user_id)
  can good = member
type team = app.teams
  member : user = app.team_members(team_id -> user_id)
  member : org#good = app.team_orgs(team_id -> org_id)
  member : team#member = app.teams(parent_id -> id)
type doc = app.docs
  team : team = team_id
  can view = team.member
sync role sync_engine
sync app.docs : view
```
