summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Common/UserBackend.h12
-rw-r--r--src/Common/UserCache.h12
-rw-r--r--src/Common/UserManager.cpp51
-rw-r--r--src/Common/UserManager.h3
4 files changed, 78 insertions, 0 deletions
diff --git a/src/Common/UserBackend.h b/src/Common/UserBackend.h
index 4004dbc..4a84fa3 100644
--- a/src/Common/UserBackend.h
+++ b/src/Common/UserBackend.h
@@ -93,6 +93,18 @@ class UserBackend {
throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED));
}
+ virtual void updateUser(unsigned long uid _UNUSED_PARAMETER_, const UserInfo &userInfo _UNUSED_PARAMETER_) throw(Core::Exception) {
+ throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED));
+ }
+
+ virtual void addGroup(const GroupInfo &groupInfo _UNUSED_PARAMETER_) throw(Core::Exception) {
+ throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED));
+ }
+
+ virtual void updateGroup(unsigned long gid _UNUSED_PARAMETER_, const GroupInfo &groupInfo _UNUSED_PARAMETER_) throw(Core::Exception) {
+ throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED));
+ }
+
public:
virtual ~UserBackend() {}
diff --git a/src/Common/UserCache.h b/src/Common/UserCache.h
index 0fe26be..7327395 100644
--- a/src/Common/UserCache.h
+++ b/src/Common/UserCache.h
@@ -78,6 +78,18 @@ class UserCache : public UserBackend, private boost::noncopyable {
backend->addUser(userInfo);
}
+ virtual void updateUser(unsigned long uid, const UserInfo &userInfo) throw(Core::Exception) {
+ backend->updateUser(uid, userInfo);
+ }
+
+ virtual void addGroup(const GroupInfo &groupInfo) throw(Core::Exception) {
+ backend->addGroup(groupInfo);
+ }
+
+ virtual void updateGroup(unsigned long gid, const GroupInfo &groupInfo) throw(Core::Exception) {
+ backend->updateGroup(gid, groupInfo);
+ }
+
UserCache(Application *application0, boost::shared_ptr<UserBackend> backend0) : application(application0), backend(backend0),
userTime(boost::posix_time::not_a_date_time), groupTime(boost::posix_time::not_a_date_time),
userGroupTime(boost::posix_time::not_a_date_time) {}
diff --git a/src/Common/UserManager.cpp b/src/Common/UserManager.cpp
index 0ccf314..c53a2af 100644
--- a/src/Common/UserManager.cpp
+++ b/src/Common/UserManager.cpp
@@ -241,5 +241,56 @@ void UserManager::addUser(const UserInfo &userInfo) throw(Core::Exception) {
throw Core::Exception(Core::Exception::NOT_IMPLEMENTED);
}
+void UserManager::updateUser(unsigned long uid, const UserInfo &userInfo) throw(Core::Exception) {
+ boost::lock_guard<boost::shared_mutex> lock(mutex);
+
+ for(BackendMap::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ try {
+ backend->second->updateUser(uid, userInfo);
+ return;
+ }
+ catch(Core::Exception e) {
+ if(e.getErrorCode() != Core::Exception::NOT_IMPLEMENTED)
+ throw e;
+ }
+ }
+
+ throw Core::Exception(Core::Exception::NOT_IMPLEMENTED);
+}
+
+void UserManager::addGroup(const GroupInfo &groupInfo) throw(Core::Exception) {
+ boost::lock_guard<boost::shared_mutex> lock(mutex);
+
+ for(BackendMap::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ try {
+ backend->second->addGroup(groupInfo);
+ return;
+ }
+ catch(Core::Exception e) {
+ if(e.getErrorCode() != Core::Exception::NOT_IMPLEMENTED)
+ throw e;
+ }
+ }
+
+ throw Core::Exception(Core::Exception::NOT_IMPLEMENTED);
+}
+
+void UserManager::updateGroup(unsigned long gid, const GroupInfo &groupInfo) throw(Core::Exception) {
+ boost::lock_guard<boost::shared_mutex> lock(mutex);
+
+ for(BackendMap::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ try {
+ backend->second->updateGroup(gid, groupInfo);
+ return;
+ }
+ catch(Core::Exception e) {
+ if(e.getErrorCode() != Core::Exception::NOT_IMPLEMENTED)
+ throw e;
+ }
+ }
+
+ throw Core::Exception(Core::Exception::NOT_IMPLEMENTED);
+}
+
}
}
diff --git a/src/Common/UserManager.h b/src/Common/UserManager.h
index 5877bac..27f4dfe 100644
--- a/src/Common/UserManager.h
+++ b/src/Common/UserManager.h
@@ -84,6 +84,9 @@ class UserManager : private boost::noncopyable {
void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception);
void addUser(const UserInfo &userInfo) throw(Core::Exception);
+ void updateUser(unsigned long uid, const UserInfo &userInfo) throw(Core::Exception);
+ void addGroup(const GroupInfo &groupInfo) throw(Core::Exception);
+ void updateGroup(unsigned long gid, const GroupInfo &groupInfo) throw(Core::Exception);
};
}