[Feature Request] .check method for v3
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 15/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript
調査の方向性
Start from the v2 check-permission guide (zenstack.dev/docs/2.x/guides/check-permission) to see how the removed .check API worked, then compare with the current v3 enhanced-client entry points and the policy-writing docs at zenstack.dev/docs/orm/access-control/write-policies. The proposal is an isAllowedTo('create' | 'update', ...) style call on the auth-scoped client, covering both model-level and row-level checks. Note v3 permission handling changed, so an equivalent design (or a decision to keep it removed) needs maintainer input before any test surface is chosen; none is defined here yet.
索引モデルが issue の本文から書いたものです。
説明
Turns out it was implemented in v2 the .check method
https://zenstack.dev/docs/2.x/guides/check-permission
Is your feature request related to a problem? Please describe.
Yes my schema defines permissions per row, some rows are editable, deleteable etc by a certain user, only my frontend is not aware of this. Currenly im mimicking my policies in some sort of permission layer to figure out if i need to show or hide a edit button in my admin area.
Describe the solution you'd like
I would like to have a similar solution as in Ruby's best authorisation plugin CanCanCan as explained here: https://github.com/CanCanCommunity/cancancan/blob/develop/docs/define_check_abilities.md
# check if a user is allowed to create a model (name is Article)
can? :create, Article, user: user
# or update a specific articel instance
@article = Article.find(params[:id])
can? :update, @article, user: user
Lets switch back to zensteack, i would like something like this, lets take the user policy
taken from https://zenstack.dev/docs/orm/access-control/write-policies
model User {
id Int @id @default(autoincrement())
email String @unique
posts Post[]
// open to signup, profiles are public
@@allow('create,read', true)
// the user himself has full access
@@allow('all', auth().id == id)
}
This could be a solution?
const userDb = authDb.$setAuth(user);
// something like this? to see if a policiy is applicable, so that i could show a [create] button or whatever
userDb.user.isAllowedTo('create')
// than for a row based
userDb.user.findUnique({where: {id: auth().id}}).isAllowedTo('update')
Im searching for this isAllowedTo or in CanCanCan the can? method.
Describe alternatives you've considered
No ive got my Ai going over all my policies and it writes a permission.ts and this a horrible developmentflow.
- 主要言語
- TypeScript
- スター
- 2.9k
- フォーク
- 157
- 平均マージ
- 2日 46分
- マージ済み PR(30日)
- 17
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
zenstackhq/zenstack のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
zenstackhq/zenstack#2873 ·
メンテナーはふだん 1 日以内に返信
-
`@default` on a field of a `@map`-ed enum emits the enum name as the column default対応中かも @jkugsiya が 4 日前に担当しました。 オープンruntime
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zenstackhq/zenstack#2868 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
zenstackhq/zenstack#2694 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
zenstackhq/zenstack#2659 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
zenstackhq/zenstack#2542 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
zenstackhq/zenstack の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
jbacalso24/mimry#459 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
architecture help wanted hive/claimed-by-architect origin/architect stage/030-pr-in-progress tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
kubestellar/console#24422 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area: backends type: docs
難易度 1/5 1〜3時間 初心者へのやさしさ 83/100
schlessera/brain-kit#2383 ·
メンテナーはふだん 1 日以内に返信
-
agent duplicate providers tool triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信