Rodrigo
10/20/2025, 2:10 PMscopes: ["device:xyz"] to the JWT and before/after calling CheckPermission, check for resource_type+":"+resource_id in scopes.
2. **two-spicedb-calls**: Create a new subject for the restricted credential, and add a relationship "credential 123 user device xyz". Change the permissions check to CheckPermission(subjects.User, userID, perms.Access, rsrcs.Device, deviceID) && CheckPermission(subjects.Credential, credentialID, perms.Access, rsrcs.Device, deviceID).
3. **two-graph-traversals**: As above, but model the credentialID -> userID relationship in the SpiceDB schema. I tried this in the playground, but combined with the custom-role-binding pattern it got complex: https://play.authzed.com/s/03vCK2EBtdfA/schema
4. **caveats**: I thought maybe caveats could help here, but couldn't see how it would provide simplicity or flexibility: I think I'd just be adding a caveat credential_scopes == "*" || credential_scopes == "device:" + resource_name and then passing both credential_scopes and resource_name into CheckPermission instead of using them directly.yetitwo
10/20/2025, 2:37 PMyetitwo
10/20/2025, 2:42 PMRodrigo
10/21/2025, 7:24 AM