diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-06-19 18:21:03 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-06-19 18:21:03 +0200 |
commit | 37c8bed9a5f2ae9141c461202fec5baa6fa21389 (patch) | |
tree | d29b6a74b4da709350beec3c12c91426bcd4dea8 /src/Server/UserManager.cpp | |
parent | 7234fe326d16d6bf9f4374a09ddc6ef790e6723f (diff) | |
download | mad-37c8bed9a5f2ae9141c461202fec5baa6fa21389.tar mad-37c8bed9a5f2ae9141c461202fec5baa6fa21389.zip |
UserManager nach Common verschoben
Diffstat (limited to 'src/Server/UserManager.cpp')
-rw-r--r-- | src/Server/UserManager.cpp | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/src/Server/UserManager.cpp b/src/Server/UserManager.cpp deleted file mode 100644 index 243457c..0000000 --- a/src/Server/UserManager.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * UserManager.cpp - * - * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de> - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "UserManager.h" -#include "UserBackend.h" - -namespace Mad { -namespace Server { - -bool UserManager::Compare::operator() (boost::shared_ptr<UserBackend> b1, boost::shared_ptr<UserBackend> b2) { - if(b1->getPriority() == b2->getPriority()) - return (b1.get() > b2.get()); - else - return (b1->getPriority() > b2->getPriority()); -} - - -boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserManager::getUserList() throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->getUserList(); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -boost::shared_ptr<Common::UserInfo> UserManager::getUserInfo(unsigned long uid) throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->getUserInfo(uid); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -boost::shared_ptr<Common::UserInfo> UserManager::getUserInfoByName(const std::string &name) throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->getUserInfoByName(name); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -boost::shared_ptr<std::set<unsigned long> > UserManager::getUserGroupList(unsigned long uid) throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->getUserGroupList(uid); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserManager::getGroupList() throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->getGroupList(); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -std::string UserManager::getGroupName(unsigned long gid) throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->getGroupName(gid); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -unsigned long UserManager::getGroupId(const std::string &name) throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->getGroupId(name); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -boost::shared_ptr<std::set<unsigned long> > UserManager::getGroupUserList(unsigned long gid) throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->getGroupUserList(gid); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -void UserManager::setPassword(unsigned long uid, const std::string &password) throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->setPassword(uid, password); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -void UserManager::addUser(const Common::UserInfo &userInfo) throw(Core::Exception) { - Core::Exception e(Core::Exception::NOT_IMPLEMENTED); - - for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) { - try { - return (*backend)->addUser(userInfo); - } - catch(Core::Exception e2) { - if(e.getErrorCode() == Core::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Core::Exception::NOT_IMPLEMENTED) - e = e2; - } - } - - throw e; -} - -} -} |