Skip to content

Instantly share code, notes, and snippets.

View gist:88240cded73b8f8c0de895974a7ad367
Tomás Arias @KNawm Apr 08 2020 22:27
Hi Yang, I submitted a proposal for porting Casbin for Dart, do you happen to know if someone other than me had some interest in the project?
Tomás Arias @KNawm Apr 08 2020 22:35
It is a very interesting project and regardless if I'm selected or not I would love to work on the project in my free time, if there's some interest I think a org-wide repo would be better for that so other people can contribute more easily
What do you think?
Yang Luo @hsluoyz Apr 08 2020 22:37
Hi Tomas, you can ask in Casbin's dev and gsoc channel for Dart interest
What progress has you got?
I personally think if you have working ACL and RBAC at least, I can create such a repo under casbin org
Tomás Arias @KNawm Apr 08 2020 22:47
View Casbin_KeyMatch4.go
// KeyMatch4 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *.
// Besides what KeyMatch3 does, KeyMatch4 can also match repeated patterns:
// "/parent/123/child/123" matches "/parent/{id}/child/{id}"
// "/parent/123/child/456" does not match "/parent/{id}/child/{id}"
// But KeyMatch3 will match both.
func KeyMatch4(key1 string, key2 string) bool {
key2 = strings.Replace(key2, "/*", "/.*", -1)
tokenMap := map[string]int{}
j := -1