Request for Prisma support
See original GitHub issueRequirements
- working on support for https://www.prisma.io/docs/concepts/components/prisma-client
- casl rules needs to be translated in
where
part of prisma query https://www.prisma.io/docs/concepts/components/prisma-client/filtering-and-sorting#filtering toPrismaQuery
should automatically detect queries on related entities and provide the correctinclude
(https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries)- no support for JSON column in Postgres
- use PrismaWhere object to define conditions in rules, so the DX is more prismy (no need to know MongoQuery)
Progress
- ~interpreter for model properties~
- custom js interpreter for PrismaQuery
- get Prisma’s
WhereInput
type in generic way - casl rules transformer
- PrimaAbility & types for custom Ability conditions matcher
- testing
- Docs
- add to prisma e2e tests https://github.com/prisma/e2e-tests/
- prisma example
Usage
import { AbilityBuilder } from "@casl/ability";
import { PrismaAbility, toPrismaQuery } from "@casl/prisma";
const { can, build } = new AbilityBuilder(PrismaAbility);
can("read", "User", { firstName: { startsWith: "John" } });
const ability = build();
await prisma.user.findMany({
include: abilitiesQuery.include,
where: {
AND: [
acessibleBy(ability).User, // permissions conditions
{ // business logic related conditions
deleted: false
}
]
]
});
Questions:
- Do I need to add
definePrismaAbility()
similar todefineAbility
which createsAbility
instance that supports MongoQuery?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:50 (25 by maintainers)
Top Results From Across the Web
Contact Support - Prisma
Contact Support for any issues or questions you want to submit as you use the Prisma Data Platform. Steps. Go to the Prisma...
Read more >Request Support - Prisma Cloud - Palo Alto Networks
For contacting support, for information on support programs, to manage your account, or to open a support case, go to the Prisma Cloud...
Read more >prisma - npm
If you have a security issue to report, please contact us at security@prisma.io. Support. Ask a question about Prisma. You can ask questions...
Read more >Prisma Cloud External Integrations API (Latest)
Returns a list of the supported integration types. Note: This request does not support Prisma Cloud integrations with the following: Okta; Qualys; Tenable....
Read more >Prisma | NestJS - A progressive Node.js framework
Prisma currently supports PostgreSQL, MySQL, SQL Server, SQLite, ... You are going to build a sample NestJS application with a REST API that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@stalniy This is great. I paid the $600. Really looking forward to having this support in CASL. If the timeline on the start / end dates change please let me know.
The major work is done! Tomorrow, I plan to add tests and if all good, I will release the 1st alpha either tomorrow or on Mon