summaryrefslogtreecommitdiffstats
path: root/src/Server/UserManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/UserManager.cpp')
-rw-r--r--src/Server/UserManager.cpp78
1 files changed, 55 insertions, 23 deletions
diff --git a/src/Server/UserManager.cpp b/src/Server/UserManager.cpp
index e32cb57..7101b2c 100644
--- a/src/Server/UserManager.cpp
+++ b/src/Server/UserManager.cpp
@@ -34,52 +34,84 @@ bool UserManager::Compare::operator() (boost::shared_ptr<UserBackend> b1, boost:
}
-boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserManager::getUserList() {
+boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > UserManager::getUserList() throw(Net::Exception) {
+ Net::Exception e(Net::Exception::NOT_IMPLEMENTED);
+
for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > ret = (*backend)->getUserList();
- if(ret)
- return ret;
+ try {
+ return (*backend)->getUserList();
+ }
+ catch(Net::Exception e2) {
+ if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED)
+ e = e2;
+ }
}
- return boost::shared_ptr<std::map<unsigned long, Common::UserInfo> >();
+ throw e;
}
-boost::shared_ptr<Common::UserInfo> UserManager::getUserInfo(unsigned long uid) {
+boost::shared_ptr<Common::UserInfo> UserManager::getUserInfo(unsigned long uid) throw(Net::Exception) {
+ Net::Exception e(Net::Exception::NOT_IMPLEMENTED);
+
for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- boost::shared_ptr<Common::UserInfo> ret = (*backend)->getUserInfo(uid);
- if(ret)
- return ret;
+ try {
+ return (*backend)->getUserInfo(uid);
+ }
+ catch(Net::Exception e2) {
+ if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED)
+ e = e2;
+ }
}
- return boost::shared_ptr<Common::UserInfo>();
+ throw e;
}
-boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserManager::getGroupList() {
+boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > UserManager::getGroupList() throw(Net::Exception) {
+ Net::Exception e(Net::Exception::NOT_IMPLEMENTED);
+
for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > ret = (*backend)->getGroupList();
- if(ret)
- return ret;
+ try {
+ return (*backend)->getGroupList();
+ }
+ catch(Net::Exception e2) {
+ if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED)
+ e = e2;
+ }
}
- return boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> >();
+ throw e;
}
-bool UserManager::setPassword(unsigned long uid, const std::string &password) {
+void UserManager::setPassword(unsigned long uid, const std::string &password) throw(Net::Exception) {
+ Net::Exception e(Net::Exception::NOT_IMPLEMENTED);
+
for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- if((*backend)->setPassword(uid, password))
- return true;
+ try {
+ return (*backend)->setPassword(uid, password);
+ }
+ catch(Net::Exception e2) {
+ if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED)
+ e = e2;
+ }
}
- return false;
+ throw e;
}
-bool UserManager::addUser(const Common::UserInfo &userInfo) {
+void UserManager::addUser(const Common::UserInfo &userInfo) throw(Net::Exception) {
+ Net::Exception e(Net::Exception::NOT_IMPLEMENTED);
+
for(std::set<boost::shared_ptr<UserBackend> >::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
- if((*backend)->addUser(userInfo))
- return true;
+ try {
+ return (*backend)->addUser(userInfo);
+ }
+ catch(Net::Exception e2) {
+ if(e.getErrorCode() == Net::Exception::NOT_IMPLEMENTED && e2.getErrorCode() != Net::Exception::NOT_IMPLEMENTED)
+ e = e2;
+ }
}
- return false;
+ throw e;
}
}