Created
February 1, 2018 20:52
-
-
Save cartazio/8fb84fb952fa987f75e4632604fbe631 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module auth where | |
open import Data.String | |
open import Level | |
data AsDelegate : Set where | |
IsDelegate : AsDelegate | |
IsLeaf : AsDelegate | |
open AsDelegate | |
data OnBehalfOf : String -> String -> AsDelegate -> Set where | |
Self : { x : String } -> OnBehalfOf x x IsDelegate | |
DelegatedTo : {root mid : String} -> (end : String) -> OnBehalfOf mid root IsDelegate -> OnBehalfOf end root IsDelegate | |
LeafAuth : {root mid : String} -> (end : String) -> OnBehalfOf mid root IsDelegate -> OnBehalfOf end root IsLeaf | |
{- | |
equivalent datalog would be (roughly) | |
onBehalfOf(me,me,Delegate). | |
onBehalfOf(agent,originalPerson,Delegate) :- onBehalfOf(mid,originalPerson,Delegate),AddsDelegateFor(mid,originalperson,agent) | |
onBhealfOf(leafAgent,originalPerson,LEAF) :- onBehalfOf(mid,originalPerson,Delegate),AddsLeafFor(mid,originalperson,leafAgent) | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment