跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Go 编程语言] 请教大神们,关于 casbin 的 abac 的一个问题

发表于

我现在在用 casbin 做权限管控。然后使用 rbac 做菜单以及接口级别的管控,基本是够用了。但是我还想做数据级别的权限。比如说一些特殊场景下,我只允许某个用户 A 查看某个数据表中,location=xxx 的数据。当然这个策略不是一成不变的,是可以动态删改的。考虑使用 casbin 的 abac 来做。

然后用 rbac 的时候我发现 casbin 其实可以拿到某个人有哪些 policy 权限,通过

e.GetImplicitPermissionsForUser("test_user")

返回的切片数据就可以获取到用户test_user的权限。那么我理解的实现方式是,不管是用 policy.csv 还是用什么其他的存储方式(比如存到 mysql )。它底层应该都是查到了以后放到内存里比对后返回匹配到的 policy

那么回到 abac 这块,我在想我可以通过 eval(sub_rule)的方式来定义多个判定策略,但是数据咋办?我也想通过 casbin 的方式直接帮我过滤数据,我数据是存在 mysql 的,可能量非常大,用 casbin 的 abac ,难道要把数据先查到,再用 abac 的策略逐个判断么?

所以想问问各位大佬都是怎么实现的。然后 rbac+abac 有整合到一起的相关参考么。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.