# AZ302: A permission that depends on itself

A permission may use itself only by inheriting: through a relation to objects of its own type (`parent.view`), or through other types' permissions that come back to it (projects and folders inside each other). That is inheritance, stored as a tree. Such a loop uses one permission per type: `can a = owner or parent.b` with `can b = owner or parent.a` is refused. Any other loop (`can edit = owner or view` with `can view = edit`) has no answer.

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

## The mistake

```authz
app role app_user
type user = app.users
type folder = app.folders
  owner : user = owner_id
  can edit = owner or view
  can view = edit
```

```
line 6: folder.view depends on itself; a permission can only recurse as 'or rel.perm' (optionally 'and {condition}') through a relation to objects, and a group only as 'member : group#member' [AZ302]
```

## Fixed

```authz
app role app_user
type user = app.users
type folder = app.folders
  owner : user = owner_id
  can edit = owner
  can view = edit
```
