summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-07-10 01:37:53 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-07-10 01:37:53 +0200
commit5bf8b6ce656ffe0740ec116057577044e3925887 (patch)
tree90a7563d5a51b87a82c4fdb8f0a0c8b45ef6e8d0 /src
parent1afb432ee5c55181bd918c038d0372479355f04b (diff)
downloadmad-5bf8b6ce656ffe0740ec116057577044e3925887.tar
mad-5bf8b6ce656ffe0740ec116057577044e3925887.zip
UserManager, UserBackend, UserCache: deleteUser und deleteGroup hinzugefügt
Diffstat (limited to 'src')
-rw-r--r--src/Common/UserBackend.h8
-rw-r--r--src/Common/UserCache.h8
-rw-r--r--src/Common/UserManager.cpp34
-rw-r--r--src/Common/UserManager.h3
4 files changed, 53 insertions, 0 deletions
diff --git a/src/Common/UserBackend.h b/src/Common/UserBackend.h
index dfb154c..2e42e12 100644
--- a/src/Common/UserBackend.h
+++ b/src/Common/UserBackend.h
@@ -97,6 +97,10 @@ class UserBackend {
throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED));
}
+ virtual void deleteUser(unsigned long uid _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));
}
@@ -105,6 +109,10 @@ class UserBackend {
throw(Core::Exception(Core::Exception::NOT_IMPLEMENTED));
}
+ virtual void deleteGroup(unsigned long gid _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 4c97352..e778e24 100644
--- a/src/Common/UserCache.h
+++ b/src/Common/UserCache.h
@@ -82,6 +82,10 @@ class UserCache : public UserBackend, private boost::noncopyable {
backend->updateUser(uid, userInfo);
}
+ virtual void deleteUser(unsigned long uid) throw(Core::Exception) {
+ backend->deleteUser(uid);
+ }
+
virtual void addGroup(const GroupInfo &groupInfo) throw(Core::Exception) {
backend->addGroup(groupInfo);
}
@@ -90,6 +94,10 @@ class UserCache : public UserBackend, private boost::noncopyable {
backend->updateGroup(gid, groupInfo);
}
+ virtual void deleteGroup(unsigned long gid) throw(Core::Exception) {
+ backend->deleteGroup(gid);
+ }
+
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 ae8f3b2..14451aa 100644
--- a/src/Common/UserManager.cpp
+++ b/src/Common/UserManager.cpp
@@ -258,6 +258,23 @@ void UserManager::updateUser(unsigned long uid, const UserInfo &userInfo) throw(
throw Core::Exception(Core::Exception::NOT_IMPLEMENTED);
}
+void UserManager::deleteUser(unsigned long uid) throw(Core::Exception) {
+ boost::lock_guard<boost::shared_mutex> lock(mutex);
+
+ for(BackendMap::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ try {
+ backend->second->deleteUser(uid);
+ 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);
@@ -292,5 +309,22 @@ void UserManager::updateGroup(unsigned long gid, const GroupInfo &groupInfo) thr
throw Core::Exception(Core::Exception::NOT_IMPLEMENTED);
}
+void UserManager::deleteGroup(unsigned long gid) throw(Core::Exception) {
+ boost::lock_guard<boost::shared_mutex> lock(mutex);
+
+ for(BackendMap::iterator backend = backends.begin(); backend != backends.end(); ++backend) {
+ try {
+ backend->second->deleteGroup(gid);
+ 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 51f0441..466b9a9 100644
--- a/src/Common/UserManager.h
+++ b/src/Common/UserManager.h
@@ -85,8 +85,11 @@ class UserManager : private boost::noncopyable {
void addUser(const UserInfo &userInfo) throw(Core::Exception);
void updateUser(unsigned long uid, const UserInfo &userInfo) throw(Core::Exception);
+ void deleteUser(unsigned long uid) throw(Core::Exception);
+
void addGroup(const GroupInfo &groupInfo) throw(Core::Exception);
void updateGroup(unsigned long gid, const GroupInfo &groupInfo) throw(Core::Exception);
+ void deleteGroup(unsigned long gid) throw(Core::Exception);
};
}