# AZ212: A subject shared two ways

A relation is shared with each subject one way: one permission shares it (`shared by ...`) and one condition, if any, decides whom (`shared if {...}`). Two `shared` lines of one relation that name a subject with another permission or another condition would say two things. Name the subject on one line, the one whose permission and condition are meant.

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
  viewer : user  shared by edit
  viewer : user, user:*  shared
  can edit  = owner
  can share = owner
  can view  = owner or viewer
```

```
line 6: folder.viewer is shared with user on line 5 too, by another permission or on another condition: name it on one line [AZ212]
```

## Fixed

```authz
app role app_user
type user = app.users
type folder = app.folders
  owner  : user = owner_id
  viewer : user  shared by edit
  viewer : user:*  shared
  can edit  = owner
  can share = owner
  can view  = owner or viewer
```
