zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

[Feature Request] Make "current user" available in Prisma client extension

Open drichardcarl opened this issue 9 months ago • 0 comments

Is your feature request related to a problem? Please describe. Not really a problem but a nice-to-have. Currently, I'm trying to create a global "logger" for any Prisma operation (model, operation and args) but I'm missing the data source for the "current user". I know it's not available in Prisma since it's without the current user context but since Zenstack modifies the actual Prisma query executed based on the current user, it would be nice if there's a way to access the "current user" or any other context inside the query extension code.

Describe the solution you'd like Not sure, expose the current context to extension code?

Describe alternatives you've considered Since I'm using ZenstackMiddleware, I'll just use the request as a first step to "log" the current operation. Although this would mean that I have to parse the request URL and possible data to get the expected "log", this would also not cover Prisma queries executed directly w/o user context (server-side code).

Additional context N/A

drichardcarl avatar Mar 10 '25 06:03 drichardcarl