From 8f1d5b4330e08a8369f9624cac377f4ff0b807aa Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 28 Jul 2015 14:51:47 +0200 Subject: [PATCH] Fixed typo. --- alethzero/MainWin.cpp | 2 +- eth/main.cpp | 6 +++--- libweb3jsonrpc/WebThreeStubServer.cpp | 2 +- libweb3jsonrpc/WebThreeStubServer.h | 4 ++-- libweb3jsonrpc/WebThreeStubServerBase.cpp | 2 +- libweb3jsonrpc/WebThreeStubServerBase.h | 10 +++++----- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 6858d7ecf..214dbab1e 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -233,7 +233,7 @@ Main::Main(QWidget *parent) : m_httpConnector.reset(new jsonrpc::HttpServer(SensibleHttpPort, "", "", dev::SensibleHttpThreads)); auto w3ss = new OurWebThreeStubServer(*m_httpConnector, this); m_server.reset(w3ss); - auto sessionKey = w3ss->newSession(SessionPermissions{{Priviledge::Admin}}); + auto sessionKey = w3ss->newSession(SessionPermissions{{Privilege::Admin}}); connect(&*m_server, SIGNAL(onNewId(QString)), SLOT(addNewId(QString))); m_server->setIdentities(keysAsVector(owned())); m_server->StartListening(); diff --git a/eth/main.cpp b/eth/main.cpp index 4d3707c10..157cc3b76 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -1779,9 +1779,9 @@ int main(int argc, char** argv) jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; }); jsonrpcServer->StartListening(); if (jsonAdmin.empty()) - jsonAdmin = jsonrpcServer->newSession(SessionPermissions{{Priviledge::Admin}}); + jsonAdmin = jsonrpcServer->newSession(SessionPermissions{{Privilege::Admin}}); else - jsonrpcServer->addSession(jsonAdmin, SessionPermissions{{Priviledge::Admin}}); + jsonrpcServer->addSession(jsonAdmin, SessionPermissions{{Privilege::Admin}}); cout << "JSONRPC Admin Session Key: " << jsonAdmin << endl; writeFile(getDataDir("web3") + "/session.key", jsonAdmin); writeFile(getDataDir("web3") + "/session.url", "http://localhost:" + toString(jsonRPCURL)); @@ -1810,7 +1810,7 @@ int main(int argc, char** argv) #if ETH_JSCONSOLE || !ETH_TRUE JSLocalConsole console; shared_ptr rpcServer = make_shared(*console.connector(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer); - string sessionKey = rpcServer->newSession(SessionPermissions{{Priviledge::Admin}}); + string sessionKey = rpcServer->newSession(SessionPermissions{{Privilege::Admin}}); console.eval("web3.admin.setSessionKey('" + sessionKey + "')"); while (!g_exit) { diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index 0a7277e06..7dd1ed246 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -77,7 +77,7 @@ bool WebThreeStubServer::eth_notePassword(string const& _password) return true; } -#define ADMIN requires(_session, Priviledge::Admin) +#define ADMIN requires(_session, Privilege::Admin) Json::Value WebThreeStubServer::admin_eth_blockQueueStatus(string const& _session) { diff --git a/libweb3jsonrpc/WebThreeStubServer.h b/libweb3jsonrpc/WebThreeStubServer.h index 2860f852b..35ea03737 100644 --- a/libweb3jsonrpc/WebThreeStubServer.h +++ b/libweb3jsonrpc/WebThreeStubServer.h @@ -40,7 +40,7 @@ class BlockQueue; struct SessionPermissions { - std::unordered_set priviledges; + std::unordered_set privileges; }; /** @@ -59,7 +59,7 @@ public: virtual void setMiningBenefactorChanger(std::function const& _f) { m_setMiningBenefactor = _f; } private: - virtual bool hasPriviledgeLevel(std::string const& _session, Priviledge _l) const override { auto it = m_sessions.find(_session); return it != m_sessions.end() && it->second.priviledges.count(_l); } + virtual bool hasPrivilegeLevel(std::string const& _session, Privilege _l) const override { auto it = m_sessions.find(_session); return it != m_sessions.end() && it->second.privileges.count(_l); } virtual dev::eth::Interface* client() override; virtual std::shared_ptr face() override; diff --git a/libweb3jsonrpc/WebThreeStubServerBase.cpp b/libweb3jsonrpc/WebThreeStubServerBase.cpp index dbcbe03cd..bf0576039 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.cpp +++ b/libweb3jsonrpc/WebThreeStubServerBase.cpp @@ -510,7 +510,7 @@ string WebThreeStubServerBase::eth_compileSerpent(string const& _source) return res; } -#define ADMIN requires(_session, Priviledge::Admin) +#define ADMIN requires(_session, Privilege::Admin) bool WebThreeStubServerBase::admin_web3_setVerbosity(int _v, string const& _session) { diff --git a/libweb3jsonrpc/WebThreeStubServerBase.h b/libweb3jsonrpc/WebThreeStubServerBase.h index 62209a5b4..4230f7237 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.h +++ b/libweb3jsonrpc/WebThreeStubServerBase.h @@ -59,7 +59,7 @@ public: virtual void put(std::string const& _name, std::string const& _key, std::string const& _value) = 0; }; -enum class Priviledge +enum class Privilege { Admin }; @@ -69,9 +69,9 @@ enum class Priviledge namespace std { -template<> struct hash +template<> struct hash { - size_t operator()(dev::Priviledge _value) const { return (size_t)_value; } + size_t operator()(dev::Privilege _value) const { return (size_t)_value; } }; } @@ -190,8 +190,8 @@ public: std::map const& ids() const { return m_shhIds; } protected: - void requires(std::string const& _session, Priviledge _l) const { if (!hasPriviledgeLevel(_session, _l)) throw jsonrpc::JsonRpcException("Invalid priviledges"); } - virtual bool hasPriviledgeLevel(std::string const& _session, Priviledge _l) const { (void)_session; (void)_l; return false; } + void requires(std::string const& _session, Privilege _l) const { if (!hasPrivilegeLevel(_session, _l)) throw jsonrpc::JsonRpcException("Invalid privileges"); } + virtual bool hasPrivilegeLevel(std::string const& _session, Privilege _l) const { (void)_session; (void)_l; return false; } virtual dev::eth::Interface* client() = 0; virtual std::shared_ptr face() = 0;