Skip to content

[Feature Request] Permissions checker #242

@keanugrieves

Description

@keanugrieves

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;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions