Not quite the same, but for a toy application I was building I had one of those terrible/clever ideas "hey the database has this elaborate comprehensive permission system, Why not have that be my applications permission system as well"
So every user is a database user and if the database sez they can view the data then they can view the data. And for my use case it worked surprisingly well.
I will note note that I think this is generally a bad idea, I have heard that the postgres role data structures scale poorly. and I personally would be terrified to expose a database to a potentially hostile environment.
See also: the schemaverse a game where you directly interface with the db server. https://github.com/Abstrct/Schemaverse