spicedb icon indicating copy to clipboard operation
spicedb copied to clipboard

API to discover/reflect relation names from a resource type (reflection)

Open fearlessfe opened this issue 3 years ago • 3 comments

conside the simple schema below

definition application {

}
definition product {
    relation application: application
    relation owner: user
}

when user "A" in application "app1" create a product "B" , I will write these two tuples into to spicedb (product:B#application@application:app1) and (product:B#owner@user:A) ,where can I get the relation name "application" and "owner"。

I tried the ReadRelationships method in spicedb,but it will give me all relationships.

fearlessfe avatar Mar 02 '22 07:03 fearlessfe

Currently, there is no dedicated API for listing the possible relations for a given Object Type.

We currently recommend maintaining these relation names in your application's code, similar to how you'd define the names of table columns when using an ORM for a relational database.

jzelinskie avatar Mar 11 '22 18:03 jzelinskie

It would be very helpful if there is API that allow to query Authorization Model.

  • Return all definition "types"
  • Return definition "types" for a given namespace.
  • Return all the relationship for a given Object Type.
  • Return all the permission for a given Object Type.

Singha2 avatar Sep 21 '22 09:09 Singha2

Few more requests:

  • Provided two types - provide all the relations possible between them. type project{ relation admin: user } [project,user]-> [admin]
  • Provided one type & relation - provide all the types that can be related provided type with the mentioned relationship. type project{ relation admin: user } [project,admin ] -> [user]
  • Provided source, target types, and relation - provide all the relation/permission of target type that can be associated here type project{ relation admin: group#all_member
    } [source : project, target : group , relation : admin ] ---> [all_member]

prchowdh avatar Oct 27 '22 18:10 prchowdh