-
-
Notifications
You must be signed in to change notification settings - Fork 122
Closed
Labels
Milestone
Description
Is your feature request related to a problem? Please describe.
I'd like to be able to check whether user has the permission to perform a create, update or delete operation so I could reflect it on the frontend.
Describe the solution you'd like
A "simple" (ha ha) function on each record that optionally takes an input and returns a boolean that indicates whether the user has permission.
Describe alternatives you've considered
Rewriting my zmodel permissions in an additional place as a separately callable function.
Additional context
Brainstorming the structure, given the model Foo
:
// If user has any create permissions, return true when input not provided or whether they can create with input
foo.canCreate(input?: Prisma.FooUncheckedCreateInput) => boolean;
// If user has update permissions on current record, return true when input not provided or return whether they can update with current record and input
foo.canUpdate(input?: Prisma.FooUncheckedUpdateInput) => boolean;
// If user has delete permissions on current record, return true
foo.canDelete() => boolean;
ymc9, DawidWraga, jasonmacdonald, bbozzay, clementoriol and 8 more