casbin / casbin-cpp

An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++
https://casbin.org
Apache License 2.0
218 stars 61 forks source link

[Question] lack support for keyGet* & keyMatach4 #209

Closed JalinWang closed 1 year ago

JalinWang commented 1 year ago

Casbin-cpp lacks some built-in functions. Is there any plan to support them all? I'm not sure if it's worthwhile to do so :(

Full function list: https://casbin.io/docs/function

Supported functions in casbin-cpp: (no keyGet* & keyMatach4)

namespace casbin {

// KeyMatch determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *.
// For example, "/foo/bar" matches "/foo/*"
bool KeyMatch(const std::string& key1, const std::string& key2);

// KeyMatch2 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *.
// For example, "/foo/bar" matches "/foo/*", "/resource1" matches "/:resource"
bool KeyMatch2(const std::string& key1, const std::string& key2);

// KeyMatch3 determines whether key1 matches the pattern of key2 (similar to RESTful path), key2 can contain a *.
// For example, "/foo/bar" matches "/foo/*", "/resource1" matches "/{resource}"
bool KeyMatch3(const std::string& key1, const std::string& key2);

// RegexMatch determines whether key1 matches the pattern of key2 in regular expression.
bool RegexMatch(const std::string& key1, const std::string& key2);

// IPMatch determines whether IP address ip1 matches the pattern of IP address ip2, ip2 can be an IP address or a CIDR pattern.
// For example, "192.168.2.123" matches "192.168.2.0/24"
bool IPMatch(const std::string& ip1, const std::string& ip2);

} // namespace casbin
casbin-bot commented 1 year ago

@EmperorYP7 @sheny1xuan @cs1137195420

hsluoyz commented 1 year ago

@cs1137195420

hsluoyz commented 1 year ago

Done by: https://github.com/casbin/casbin-cpp/pull/211 and https://github.com/casbin/casbin-cpp/pull/212