diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-08-16 03:01:12 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-08-16 03:01:12 +0200 |
commit | b6f7d36a544a7a8c18c815ef4158cf684108d06d (patch) | |
tree | 417e12f98f5b2c6d03bd740999532e61d60a664a /src/Common/Backends | |
parent | c1cb92bc30256171bfafb22cf8512142afee97cf (diff) | |
download | mad-b6f7d36a544a7a8c18c815ef4158cf684108d06d.tar mad-b6f7d36a544a7a8c18c815ef4158cf684108d06d.zip |
Passwörter können gesetzt werden
Diffstat (limited to 'src/Common/Backends')
-rw-r--r-- | src/Common/Backends/NetworkUserBackend.cpp | 27 | ||||
-rw-r--r-- | src/Common/Backends/NetworkUserBackend.h | 17 |
2 files changed, 37 insertions, 7 deletions
diff --git a/src/Common/Backends/NetworkUserBackend.cpp b/src/Common/Backends/NetworkUserBackend.cpp index da964e7..00bd378 100644 --- a/src/Common/Backends/NetworkUserBackend.cpp +++ b/src/Common/Backends/NetworkUserBackend.cpp @@ -115,6 +115,15 @@ void NetworkUserBackend::UserGroupRequest::sendRequest() { sendPacket(packet); } +void NetworkUserBackend::PasswordRequest::sendRequest() { + XmlPacket packet; + packet.setType("SetPassword"); + packet.set("uid", uid); + packet.set("password", password); + + sendPacket(packet); +} + boost::shared_ptr<const std::map<unsigned long, UserInfo> > NetworkUserBackend::getUserList(boost::posix_time::ptime *timestamp) throw(Core::Exception) { application->getThreadManager()->detach(); @@ -397,11 +406,6 @@ boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > NetworkUse } -/*void NetworkUserBackend::setPassword(unsigned long uid, const std::string &password) throw(Core::Exception) { - -}*/ - - void NetworkUserBackend::checkUserInfo(const UserInfo &userInfo) throw(Core::Exception) { application->getThreadManager()->detach(); @@ -524,6 +528,19 @@ void NetworkUserBackend::deleteUserFromGroup(unsigned long uid, unsigned long gi throw result.second; } + +void NetworkUserBackend::setPassword(unsigned long uid, const std::string &password) throw(Core::Exception) { + application->getThreadManager()->detach(); + + boost::shared_ptr<PasswordRequest> request(new PasswordRequest(application, uid, password)); + application->getRequestManager()->sendRequest(connection, request); + request->wait(); + + std::pair<boost::shared_ptr<const XmlPacket>, Core::Exception> result = request->getResult(); + if(!result.first || result.second) + throw result.second; +} + } } } diff --git a/src/Common/Backends/NetworkUserBackend.h b/src/Common/Backends/NetworkUserBackend.h index a3fa1a6..1ab0b58 100644 --- a/src/Common/Backends/NetworkUserBackend.h +++ b/src/Common/Backends/NetworkUserBackend.h @@ -137,6 +137,19 @@ class NetworkUserBackend : public UserDBBackend { : Request(application), type(type0), uid(uid0), gid(gid0) {} }; + class PasswordRequest : public Request { + private: + unsigned long uid; + std::string password; + + protected: + virtual void sendRequest(); + + public: + PasswordRequest(Application *application, unsigned long uid0, const std::string &password0) + : Request(application), uid(uid0), password(password0) {} + }; + static const std::string name; Application *application; @@ -155,8 +168,6 @@ class NetworkUserBackend : public UserDBBackend { virtual boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > getFullUserGroupList(boost::posix_time::ptime *timestamp) throw(Core::Exception); - //virtual void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception); - virtual void checkUserInfo(const UserInfo &userInfo) throw(Core::Exception); virtual void addUser(const UserInfo &userInfo) throw(Core::Exception); virtual void updateUser(unsigned long uid, const Common::UserInfo &userInfo) throw(Core::Exception); @@ -170,6 +181,8 @@ class NetworkUserBackend : public UserDBBackend { virtual void addUserToGroup(unsigned long uid, unsigned long gid) throw(Core::Exception); virtual void deleteUserFromGroup(unsigned long uid, unsigned long gid) throw(Core::Exception); + virtual void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception); + public: NetworkUserBackend(Application *application0, Connection *connection0) : application(application0), connection(connection0) {} |