Hi Everyone, How to make caveat to take inputs fo...
# spicedb
n
Hi Everyone, How to make caveat to take inputs form the relations instead of passing static value during checkpermission, I want to use the relation that is already saved in spicedb? I have the below schema definition user {} definition class{ relation member : user } caveat same_class(my_class string, friend_class string){ my_class == friend_class } definition my_permission { relation friend: user with same_class permission communicate = friend } and my Relationships are class:classA#member@user:Tom class:classA#member@user:Glad class:classB#member@user:Dev my_permission:Tom_permission#friend@user:Dev[same_class] my_permission:Tom_permission#friend@user:Glad[same_class] assertions: assertTrue: - 'my_permission:Tom_permission#communicate@user:Glad with {"my_class":"classA","friend_class":"classA"}' assertFalse: - 'my_permission:Tom_permission#communicate@user:Dev with {"my_class":"classA","friend_class":"classB"}' Scenario : Tom wants to communicate to friends who belong to the same class as Tom. here in the assertions I am passing my_class and friend_class values as a string. instead of this I want to dynamically read it from spicedb existing relationship. example Glad belong to classA and Dev belong to ClassB and Tom belong to classA is defined already in the relationships. is it possible to do this through caveat or please suggest any other options to achieve the same?