diff --git a/libresapi/src/api/IdentityHandler.cpp b/libresapi/src/api/IdentityHandler.cpp index 097a04ef7..1b298467d 100644 --- a/libresapi/src/api/IdentityHandler.cpp +++ b/libresapi/src/api/IdentityHandler.cpp @@ -146,6 +146,8 @@ IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, RsIden addResourceHandler("delete_identity", this, &IdentityHandler::handleDeleteIdentity); addResourceHandler("get_identity_details", this, &IdentityHandler::handleGetIdentityDetails); + + addResourceHandler("set_ban_node", this, &IdentityHandler::handleSetBanNode); } IdentityHandler::~IdentityHandler() @@ -472,6 +474,19 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp) resp.setOk(); } +void IdentityHandler::handleSetBanNode(Request& req, Response& resp) +{ + std::string pgp_id; + req.mStream << makeKeyValueReference("pgp_id", pgp_id); + RsPgpId pgpId(pgp_id); + + bool banned_node; + req.mStream << makeKeyValueReference("banned_node", banned_node); + rsReputations->banNode(pgpId, banned_node); + + resp.setOk(); +} + ResponseTask* IdentityHandler::handleOwn(Request & /* req */, Response &resp) { StateToken state; diff --git a/libresapi/src/api/IdentityHandler.h b/libresapi/src/api/IdentityHandler.h index 0780585e8..3824d483d 100644 --- a/libresapi/src/api/IdentityHandler.h +++ b/libresapi/src/api/IdentityHandler.h @@ -31,6 +31,8 @@ private: void handleGetIdentityDetails(Request& req, Response& resp); + void handleSetBanNode(Request& req, Response& resp); + ResponseTask *handleOwn(Request& req, Response& resp); ResponseTask *handleCreateIdentity(Request& req, Response& resp); ResponseTask *handleDeleteIdentity(Request& req, Response& resp);