Char2sGu / blogs

0 stars 0 forks source link

不要用MikroORM中Filter的第二个参数替代鉴权 | Just Blogs #6

Open Char2sGu opened 3 years ago

Char2sGu commented 3 years ago

https://thenightmarex.github.io/blogs/2021/07/25/dont-use-the-second-parameter-of-mikro-orm-filters-to-replace-access-control/

MikroORM 的 Filter 无疑是其一大特色,可以很方便地控制用户可见资源。 其 cond 回调可以接受第二个参数 type: 'read' | 'update' | 'delete',聪明蛋们肯定想到可以根据 type 来动态控制: 1234567891011@Filter({ name: "crud",