Casbin Forum runs on Casnode, the open-source Discourse-style forum. Try the Casnode demo →
Casbin Forum

Why does an empty string in e.GetFilteredPolicy(int, "") function as a wildcard?

I'd think it'd be better to make it function as filtering for rules where the specified field is actually an empty string

Like why would it assume I'm trying to filter by a wildcard when I explicitly used "" instead of "*"

It seems to me like it's making assumptions that it shouldn't be making

Is this just a legacy code relic that hasn't been changed because it'd break authorization systems for anyone who updates and doesn't read the changelog properly

3views
2users
1 minread

If that's the case, we could add another method something like GetStrictFilteredPolicy which would treat "" as empty string, "*" as wildcard

If you're gonna support empty strings in the adapters (as has been discussed), the GetFilteredPolicy method should support that, in my opinion.

Also @hsluoyz you know ReBAC is possible with casbin if you just simply have an external relationship system? Might be worth adding that to the README's

1 / 5
Feb 20