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

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