Browse Source

Fixed typo.

cl-refactor
chriseth 10 years ago
parent
commit
8f1d5b4330
  1. 2
      alethzero/MainWin.cpp
  2. 6
      eth/main.cpp
  3. 2
      libweb3jsonrpc/WebThreeStubServer.cpp
  4. 4
      libweb3jsonrpc/WebThreeStubServer.h
  5. 2
      libweb3jsonrpc/WebThreeStubServerBase.cpp
  6. 10
      libweb3jsonrpc/WebThreeStubServerBase.h

2
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();

6
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<dev::WebThreeStubServer> rpcServer = make_shared<dev::WebThreeStubServer>(*console.connector(), web3, make_shared<SimpleAccountHolder>([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector<KeyPair>(), 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)
{

2
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)
{

4
libweb3jsonrpc/WebThreeStubServer.h

@ -40,7 +40,7 @@ class BlockQueue;
struct SessionPermissions
{
std::unordered_set<Priviledge> priviledges;
std::unordered_set<Privilege> privileges;
};
/**
@ -59,7 +59,7 @@ public:
virtual void setMiningBenefactorChanger(std::function<void(Address const&)> 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<dev::shh::Interface> face() override;

2
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)
{

10
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<dev::Priviledge>
template<> struct hash<dev::Privilege>
{
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<dev::Public, dev::Secret> 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<dev::shh::Interface> face() = 0;

Loading…
Cancel
Save