Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Completion of Enforcer API #103

Merged
merged 1 commit into from
Jun 8, 2021
Merged

Conversation

EmperorYP7
Copy link
Member

@EmperorYP7 EmperorYP7 commented May 31, 2021

Fixes #96 partially

Signed-off-by: Yash Pandey (YP) yash.btech.cs19@iiitranchi.ac.in


Description

  • This code implements some methods of the enforcer API components from casbin to be on par with GoLang variant. Some of them includes :
// Public API
std::vector<bool> BatchEnforce(const std::vector<std::vector<std::string>>& requests);
std::vector<bool> BatchEnforceWithMatcher(const std::string& matcher, const std::vector<std::vector<std::string>>& requests);

// Management API functions
bool UpdateGroupingPolicy(const std::vector<std::string>& oldRule, const std::vector<std::string>& newRule);
bool UpdateNamedGroupingPolicy(const std::string& ptype, const std::vector<std::string>& oldRule, const std::vector<std::string>& newRule);
bool UpdatePolicy(const std::vector<std::string>& oldPolicy, const std::vector<std::string>& newPolicy);
bool UpdateNamedPolicy(const std::string& ptype, const std::vector<std::string>& p1, const std::vector<std::string>& p2);
bool UpdatePolicies(const std::vector<std::vector<std::string>>& oldPolices, const std::vector<std::vector<std::string>>& newPolicies);
bool UpdateNamedPolicies(const std::string& ptype, const std::vector<std::vector<std::string>>& p1, const std::vector<std::vector<std::string>>& p2);

// RBAC API member functions.
bool updatePolicy(const std::string& sec, const std::string& p_type, const std::vector<std::string>& oldRule, const std::vector<std::string>& newRule);
bool updatePolicies(const std::string& sec, const std::string& p_type, const std::vector<std::vector<std::string>>& p1, const std::vector<std::vector<std::string>>& p2);
  • It also changes the convention of using this->privateMember to access private members of a class to just m_privateMember.

  • In compliance with const reference for strings and vectors to prevent multiple allocations.

@EmperorYP7 EmperorYP7 force-pushed the api-completion branch 3 times, most recently from ffec279 to d8d7f1d Compare June 6, 2021 21:46
Signed-off-by: Yash Pandey (YP) <yash.btech.cs19@iiitranchi.ac.in>

feat: Added logger and function definitions

Signed-off-by: Yash Pandey (YP) <yash.btech.cs19@iiitranchi.ac.in>

fix: Fixed build errors on unix

Signed-off-by: Yash Pandey (YP) <yash.btech.cs19@iiitranchi.ac.in>

fix: Logger path

Signed-off-by: Yash Pandey (YP) <yash.btech.cs19@iiitranchi.ac.in>

fix: include error

Signed-off-by: Yash Pandey (YP) <yash.btech.cs19@iiitranchi.ac.in>

feat: Added dummy definitions

Signed-off-by: Yash Pandey (YP) <yash.btech.cs19@iiitranchi.ac.in>

fix: Fixed errors

fix: final fix for UNIX systems

Signed-off-by: EmperorYP7 <yash.btech.cs19@iiitranchi.ac.in>
@EmperorYP7 EmperorYP7 changed the title feat: Completion of API feat: Completion of Enforcer API Jun 6, 2021
@EmperorYP7 EmperorYP7 marked this pull request as ready for review June 6, 2021 22:16
@hsluoyz hsluoyz requested review from divy9881 and xcaptain June 7, 2021 02:26
@hsluoyz
Copy link
Member

hsluoyz commented Jun 7, 2021

@xcaptain @divy9881 plz review.

casbin/logger.cpp Show resolved Hide resolved
@hsluoyz hsluoyz merged commit c4a0e11 into casbin:master Jun 8, 2021
@github-actions
Copy link

github-actions bot commented Jun 8, 2021

🎉 This PR is included in version 1.19.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to C++17
3 participants