summaryrefslogtreecommitdiffstats
path: root/src/Common/UserCache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/UserCache.h')
-rw-r--r--src/Common/UserCache.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/Common/UserCache.h b/src/Common/UserCache.h
index 548be2e..0fe26be 100644
--- a/src/Common/UserCache.h
+++ b/src/Common/UserCache.h
@@ -24,7 +24,7 @@
#include <limits>
-#include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/recursive_mutex.hpp>
namespace Mad {
namespace Common {
@@ -40,32 +40,35 @@ class UserCache : public UserBackend, private boost::noncopyable {
boost::shared_ptr<UserBackend> backend;
- boost::shared_mutex mutex;
+ boost::recursive_mutex mutex;
boost::shared_ptr<const std::map<unsigned long, UserInfo> > users;
boost::shared_ptr<std::map<std::string, unsigned long> > userNames;
Core::Exception userException;
+ boost::posix_time::ptime userTime;
boost::shared_ptr<const std::map<unsigned long, GroupInfo> > groups;
boost::shared_ptr<std::map<std::string, unsigned long> > groupNames;
Core::Exception groupException;
+ boost::posix_time::ptime groupTime;
boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > userGroups;
boost::shared_ptr<std::multimap<unsigned long, unsigned long> > groupUsers;
Core::Exception userGroupException;
+ boost::posix_time::ptime userGroupTime;
protected:
- virtual boost::shared_ptr<const std::map<unsigned long, UserInfo> > getUserList() throw(Core::Exception);
- virtual boost::shared_ptr<const UserInfo> getUserInfo(unsigned long uid) throw(Core::Exception);
- virtual boost::shared_ptr<const UserInfo> getUserInfoByName(const std::string &name) throw(Core::Exception);
- virtual boost::shared_ptr<const std::set<unsigned long> > getUserGroupList(unsigned long uid) throw(Core::Exception);
+ virtual boost::shared_ptr<const std::map<unsigned long, UserInfo> > getUserList(boost::posix_time::ptime *timestamp) throw(Core::Exception);
+ virtual boost::shared_ptr<const UserInfo> getUserInfo(unsigned long uid, boost::posix_time::ptime *timestamp) throw(Core::Exception);
+ virtual boost::shared_ptr<const UserInfo> getUserInfoByName(const std::string &name, boost::posix_time::ptime *timestamp) throw(Core::Exception);
+ virtual boost::shared_ptr<const std::set<unsigned long> > getUserGroupList(unsigned long uid, boost::posix_time::ptime *timestamp) throw(Core::Exception);
- virtual boost::shared_ptr<const std::map<unsigned long, GroupInfo> > getGroupList() throw(Core::Exception);
- virtual boost::shared_ptr<const GroupInfo> getGroupInfo(unsigned long gid) throw(Core::Exception);
- 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::map<unsigned long, GroupInfo> > getGroupList(boost::posix_time::ptime *timestamp) throw(Core::Exception);
+ virtual boost::shared_ptr<const GroupInfo> getGroupInfo(unsigned long gid, boost::posix_time::ptime *timestamp) throw(Core::Exception);
+ virtual boost::shared_ptr<const GroupInfo> getGroupInfoByName(const std::string &name, boost::posix_time::ptime *timestamp) throw(Core::Exception);
+ virtual boost::shared_ptr<const std::set<unsigned long> > getGroupUserList(unsigned long gid, boost::posix_time::ptime *timestamp) throw(Core::Exception);
- virtual boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > getFullUserGroupList() throw(Core::Exception);
+ virtual boost::shared_ptr<const std::multimap<unsigned long, unsigned long> > getFullUserGroupList(boost::posix_time::ptime *timestamp) throw(Core::Exception);
virtual void setPassword(unsigned long uid, const std::string &password) throw(Core::Exception) {
backend->setPassword(uid, password);
@@ -75,7 +78,9 @@ class UserCache : public UserBackend, private boost::noncopyable {
backend->addUser(userInfo);
}
- UserCache(Application *application0, boost::shared_ptr<UserBackend> backend0) : application(application0), backend(backend0) {}
+ 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) {}
};
}