spicedb icon indicating copy to clipboard operation
spicedb copied to clipboard

Add support for mixins/templates/inheritance in schema

Open jakedt opened this issue 3 years ago • 2 comments

Often several models share the same set of relations and permissions. It would be nice if Authzed schema supported some kind of way of deduplicating these definitions, and possibly also for re-using that mechanism to simplify type declarations:

example:

mixin crud {
  relation editor: user
  relation viewer: user
  permission create = editor
  permission read = editor + viewer
  permission update = editor
  permission delete = editor
}

definition book {
   mixin crud
}

definition car {
  mixin crud 
}

definition movie {
  mixin crud 
}

and possibly:

definition anotherthing {
  relation crudable: crud
}

jakedt avatar Oct 27 '21 02:10 jakedt