问题标签 [casl]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
130 浏览

nest - 使用 CASL 的 Nest JS 授权无法按预期工作

期待:

  • 只能获取 id 等于我的 id 的用户信息(保存在 JWT 令牌中)。

当前结果:

  • 我可以获取有关具有某些 id 的所有用户的信息。

创建此解决方案时使用了 Nest Js 文档。感谢您的帮助。

  1. /casl-ability.factory.ts
  1. /getUser.policyHandler.ts
  1. /types.ts
  1. /policies.guard.ts
  1. 用户解析器.ts
0 投票
0 回答
17 浏览

javascript - Casl JS 有 Dart 实现吗?

casl.js是否有任何飞镖实现以将其与颤振项目一起使用?

0 投票
0 回答
7 浏览

nestjs - NestJS 和 CASL 库的问题

我的问题是,使用 Actions 和 Subjects 工作得很好,但我添加的所有条件或字段都没有影响。我希望 ID 为 1 的用户不能删除具有其他 ID 的用户,但可以删除他自己我在我的应用程序模块中将警卫添加为全局警卫有人知道问题可能是什么吗?

我的代码:

能力.decorator.ts:

能力工厂.ts

能力守卫.ts