Skip to content

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

@drichardcarl

Description

@drichardcarl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions