diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-06-30 22:57:29 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-06-30 22:57:29 +0200 |
commit | c9c2e1401bae1938fe392f6ee0903939b63b050c (patch) | |
tree | 84ed6f8fa3e46e8bd8cd45558adb5b539cd2a06c /src/Common/Backends | |
parent | 68ec8067feec09a6fecf8bf2fbffb5d757db3d4a (diff) | |
download | mad-c9c2e1401bae1938fe392f6ee0903939b63b050c.tar mad-c9c2e1401bae1938fe392f6ee0903939b63b050c.zip |
UserManager erweitert
Ermögliche Caching der User-Group-Zuordnungen
Diffstat (limited to 'src/Common/Backends')
-rw-r--r-- | src/Common/Backends/NetworkUserBackend.cpp | 20 | ||||
-rw-r--r-- | src/Common/Backends/NetworkUserBackend.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/Common/Backends/NetworkUserBackend.cpp b/src/Common/Backends/NetworkUserBackend.cpp index 81fc94a..f75783c 100644 --- a/src/Common/Backends/NetworkUserBackend.cpp +++ b/src/Common/Backends/NetworkUserBackend.cpp @@ -188,6 +188,26 @@ boost::shared_ptr<const std::set<unsigned long> > NetworkUserBackend::getGroupUs return userList; } +boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > NetworkUserBackend::getFullUserGroupList() throw(Core::Exception) { + boost::shared_ptr<SimpleUserRequest> request(new SimpleUserRequest(application, "GetFullUserGroupList")); + 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; + + boost::shared_ptr<std::multimap<unsigned long, unsigned long> > ret(new std::multimap<unsigned long, unsigned long>); + + const XmlPacket::List *list = result.first->getList("userGroupList"); + if(list) { + for(XmlPacket::List::const_iterator entry = list->begin(); entry != list->end(); ++entry) + ret->insert(std::make_pair(entry->get<unsigned long>("uid"), entry->get<unsigned long>("gid"))); + } + + return ret; +} + /*void NetworkUserBackend::setPassword(unsigned long uid, const std::string &password) throw(Core::Exception) { diff --git a/src/Common/Backends/NetworkUserBackend.h b/src/Common/Backends/NetworkUserBackend.h index c569ab6..66be909 100644 --- a/src/Common/Backends/NetworkUserBackend.h +++ b/src/Common/Backends/NetworkUserBackend.h @@ -77,6 +77,8 @@ class NetworkUserBackend : public UserBackend { virtual boost::shared_ptr<const GroupInfo> getGroupInfoByName(const std::string &name) throw(Core::Exception); virtual boost::shared_ptr<const std::set<unsigned long> > getGroupUserList(unsigned long gid) throw(Core::Exception); + virtual boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > getFullUserGroupList() throw(Core::Exception); + //virtual void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception); //virtual void addUser(const UserInfo &userInfo) throw(Core::Exception); |