-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema-and-data.yaml
52 lines (45 loc) · 1.27 KB
/
schema-and-data.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
schema: |-
/**
* user represents a user that can be granted role(s)
*/
definition user {}
/**
* document represents a document.
*/
definition document {
/**
* writer indicates that the user is a writer on the document.
*/
relation writer: user
/**
* reader indicates that the user is a reader on the document.
*/
relation reader: user
/**
* edit indicates that the user has permission to edit the document.
*/
permission edit = writer
/**
* view indicates that the user has permission to view the document, if they
* are a `reader` *or* have `edit` permission.
*/
permission view = reader + edit
}
relationships: |-
document:firstdoc#writer@user:alice
document:firstdoc#reader@user:bob
document:seconddoc#reader@user:alice
assertions:
assertTrue:
- "document:firstdoc#view@user:alice"
- "document:firstdoc#view@user:bob"
- "document:seconddoc#view@user:alice"
assertFalse:
- "document:seconddoc#view@user:bob"
validation:
document:firstdoc#view:
- "[user:alice] is <document:firstdoc#writer>"
- "[user:bob] is <document:firstdoc#reader>"
document:seconddoc#view:
- "[user:alice] is <document:seconddoc#reader>"