]> git.stg.codes - stg.git/commitdiff
Implemeted chg-admin.
authorMaxim Mamontov <faust.madf@gmail.com>
Thu, 29 May 2014 08:31:11 +0000 (11:31 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Thu, 29 May 2014 08:31:11 +0000 (11:31 +0300)
projects/sgconf/admins.cpp

index 739a8aef2239ed8e9443424874273ad7979e4cf5..7161e1efd421664ac6aa9e65fae140892af7006e 100644 (file)
@@ -154,7 +154,6 @@ bool AddAdminFunction(const SGCONF::CONFIG & config,
                       const std::string & arg,
                       const std::map<std::string, std::string> & options)
 {
-// TODO
 ADMIN_CONF_RES conf;
 conf.login = arg;
 SGCONF::MaybeSet(options, "priv", conf.priv, ConvPriv);
@@ -170,9 +169,15 @@ bool ChgAdminFunction(const SGCONF::CONFIG & config,
                       const std::string & arg,
                       const std::map<std::string, std::string> & options)
 {
-// TODO
-std::cerr << "Unimplemented.\n";
-return false;
+ADMIN_CONF_RES conf;
+conf.login = arg;
+SGCONF::MaybeSet(options, "priv", conf.priv, ConvPriv);
+SGCONF::MaybeSet(options, "password", conf.password);
+STG::SERVCONF proto(config.server.data(),
+                    config.port.data(),
+                    config.userName.data(),
+                    config.userPass.data());
+return proto.ChgAdmin(conf, SimpleCallback, NULL) == STG::st_ok;
 }
 
 } // namespace anonymous