fastapi-user-auth
fastapi-user-auth copied to clipboard
使用add_grouping_policy添加子角色继承, 但是require在判定角色时不能识别继承的子角色
await auth.create_role_user("admin")
await auth.create_role_user("root")
await auth.enforcer.add_grouping_policy("r:root", "r:admin")
# 在dependencies中使用root验证auth.requires("admin")失败
在auth.has_role_for_user函数中, 能否使用self.enforcer.get_implicit_roles_for_user再自己判定呢?
(也看到casbin没有提供has_implicit_roles_for_user了, 可能这其中有效率之类的考虑。如果是我的使用方式有问题, 请告诉我, 非常感谢!)