-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path06-user.als
45 lines (35 loc) · 920 Bytes
/
06-user.als
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
open util/graph[Object] as object_graph
abstract sig Object {
var private parent: lone Folder,
}
sig App extends Object {}
sig Folder extends Object {
var children: set Object,
}
fact start_as_a_tree {
object_graph/tree[children]
}
fact parent_is_opposite_of_children {
always {
all o: Object {
o.parent = {f: Folder | o in f.children}
}
}
}
fun root_folder: one Folder {
{f: Folder | no f.parent}
}
private enum Permission { CannotSee, Use, Edit, Own }
sig Group {
explicit: Permission lone -> set Object,
}
// For now, we use only one User.
one sig User {
// A User can be a member of multiple Groups
groups: set Group,
// This relation represents the calculated level of access the User has to
// each Object.
var calculated: Permission one -> Object,
}
run make_filesystem {
} for exactly 2 Folder, exactly 1 App, exactly 1 Group