Skip to content

Instantly share code, notes, and snippets.

@hwayne

hwayne/auth.als Secret

Created July 17, 2020 22:46
Show Gist options
  • Save hwayne/ad1b61fec519142a890a4f6608ea6a97 to your computer and use it in GitHub Desktop.
Save hwayne/ad1b61fec519142a890a4f6608ea6a97 to your computer and use it in GitHub Desktop.
PLTalk Model
sig User {}
sig Resource {
, allow: set User
, parent: lone Resource
}
fact "No resource can be its own ancestor" {
no iden & ^parent
}
assert parent_implies_child {
-- if you can access a parent, you can access its child
all u: User, r: Resource |
u.can_access[r] =>
all c: r.~parent |
u.can_access[c]
}
pred can_access[u: User, r: Resource] {
u in r.allow or u in r.^parent.allow
}
check parent_implies_child
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment