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

     1  ---
     2  schema: |+
     3    definition user {}
     4  
     5    caveat some_caveat(somecondition int) {
     6      somecondition == 42
     7    }
     8  
     9    caveat another_caveat(anothercondition string) {
    10      anothercondition == 'hello world'
    11    }
    12  
    13    definition organization {
    14      relation viewer: user with some_caveat | user
    15      permission view = viewer
    16    }
    17  
    18    definition document {
    19      relation org: organization with another_caveat | organization
    20      permission view = org->view
    21    }
    22  
    23  relationships: >-
    24    organization:someorg#viewer@user:tom[some_caveat:{"somecondition":42}]
    25  
    26    organization:someorg#viewer@user:fred[some_caveat:{"somecondition":41}]
    27  
    28    organization:someorg#viewer@user:sarah[some_caveat]
    29  
    30    organization:anotherorg#viewer@user:tom[some_caveat:{"somecondition":42}]
    31  
    32    organization:anotherorg#viewer@user:fred[some_caveat:{"somecondition":41}]
    33  
    34    organization:anotherorg#viewer@user:sarah[some_caveat]
    35  
    36    document:directorgdoc#org@organization:someorg
    37  
    38    document:caveatedorgdoc#org@organization:anotherorg[another_caveat]
    39  
    40    document:staticorgdoc#org@organization:anotherorg[another_caveat:{"anothercondition":"hello world"}]
    41  
    42    document:staticnoorgdoc#org@organization:anotherorg[another_caveat:{"anothercondition":"nope"}]
    43  assertions:
    44    assertTrue:
    45      - "document:directorgdoc#view@user:tom"
    46      - "document:staticorgdoc#view@user:tom"
    47      - 'document:caveatedorgdoc#view@user:tom with {"anothercondition": "hello world"}'
    48      - 'document:caveatedorgdoc#view@user:sarah with {"somecondition": 42, "anothercondition": "hello world"}'
    49    assertCaveated:
    50      - "document:directorgdoc#view@user:sarah"
    51      - "document:caveatedorgdoc#view@user:tom"
    52      - "document:staticorgdoc#view@user:sarah"
    53      - "document:caveatedorgdoc#view@user:sarah"
    54      - "document:caveatedorgdoc#view@user:fred"
    55      - 'document:caveatedorgdoc#view@user:sarah with {"anothercondition": "hello world"}'
    56    assertFalse:
    57      - "document:directorgdoc#view@user:fred"
    58      - "document:staticnoorgdoc#view@user:tom"
    59      - "document:staticorgdoc#view@user:fred"
    60      - 'document:caveatedorgdoc#view@user:tom with {"anothercondition": "nope"}'
    61      - 'document:caveatedorgdoc#view@user:sarah with {"somecondition": 41, "anothercondition": "hello world"}'