Added: Handling requests to set opinion about identity

This commit is contained in:
Konrad 2017-04-18 22:58:15 +02:00
parent 3f54568d7f
commit 120ca9d078
2 changed files with 17 additions and 0 deletions

View File

@ -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;

View File

@ -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);