github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/internal/services/integrationtesting/testconfigs/publiccaveat.yaml (about)

     1  ---
     2  schema: |+
     3    definition user {}
     4  
     5    caveat some_caveat(somecondition int) {
     6      somecondition == 42
     7    }
     8  
     9    definition document {
    10    	relation viewer: user:* with some_caveat | user
    11      permission view = viewer
    12    }
    13  
    14  relationships: >-
    15    document:firstdoc#viewer@user:*[some_caveat]
    16  
    17    document:firstdoc#viewer@user:fred
    18  
    19  assertions:
    20    assertTrue:
    21      - 'document:firstdoc#view@user:tom with {"somecondition": 42}'
    22      - 'document:firstdoc#view@user:sarah with {"somecondition": 42}'
    23      - "document:firstdoc#view@user:fred"
    24      - 'document:firstdoc#view@user:fred with {"somecondition": 41}'
    25    assertCaveated:
    26      - "document:firstdoc#view@user:tom"
    27      - "document:firstdoc#view@user:sarah"
    28    assertFalse:
    29      - 'document:firstdoc#view@user:tom with {"somecondition": 41}'
    30      - 'document:firstdoc#view@user:sarah with {"somecondition": 41}'