summaryrefslogtreecommitdiffstats
path: root/src/modules/UserConfigBackendHome
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/UserConfigBackendHome')
-rw-r--r--src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp42
-rw-r--r--src/modules/UserConfigBackendHome/UserConfigBackendHome.h4
2 files changed, 11 insertions, 35 deletions
diff --git a/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp b/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp
index 4dca729..a19769c 100644
--- a/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp
+++ b/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp
@@ -31,40 +31,16 @@ namespace Mad {
namespace Modules {
namespace UserConfigBackendHome {
-bool UserConfigBackendHome::handleConfigEntry(const Core::ConfigEntry &entry, bool /*handled*/) {
- if(entry[0].getKey().matches("UserManager")) {
- if(entry[1].getKey().matches("Skeleton")) {
- if(entry[2].isEmpty())
- skeleton = entry[1][0];
- }
- else if(entry[1].getKey().matches("HomeDir")) {
- if(entry[2].isEmpty())
- homeDir = entry[1][0];
- }
- else if(entry[1].getKey().matches("UserDirMode")) {
- if(entry[2].isEmpty()) {
- if(entry[1][0].isEmpty()) {
- dirMode = 0755;
- }
- else {
- char *endptr;
- unsigned long val = std::strtoul(entry[1][0].toString().c_str(), &endptr, 8);
- if(*endptr || val > 07777) {
- application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: DirMode '%s'", entry[1][0].toLocale().c_str());
- }
- else {
- dirMode = val;
- }
- }
- }
- }
- else if(!entry[1].isEmpty())
- return false;
-
- return true;
+void UserConfigBackendHome::configure() {
+ skeleton = application->getConfigManager()->get("UserManager.Skeleton");
+ homeDir = application->getConfigManager()->get("UserManager.HomeDir", "/home");
+
+ dirMode = std::strtoul(application->getConfigManager()->get("UserManager.UserDirMode", "775").toString().c_str(), 0, 8);
+ if(dirMode > 07777) {
+ application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: UserDirMode '%s'",
+ application->getConfigManager()->get("UserManager.UserDirMode").toLocale().c_str());
+ dirMode = 0775;
}
-
- return false;
}
void UserConfigBackendHome::setOwnerAndCopyMode(const std::string &source, const std::string &dest, const Common::UserInfo &userInfo, bool isSymlink) {
diff --git a/src/modules/UserConfigBackendHome/UserConfigBackendHome.h b/src/modules/UserConfigBackendHome/UserConfigBackendHome.h
index e82795c..41370ff 100644
--- a/src/modules/UserConfigBackendHome/UserConfigBackendHome.h
+++ b/src/modules/UserConfigBackendHome/UserConfigBackendHome.h
@@ -47,14 +47,14 @@ class UserConfigBackendHome : public Common::UserConfigBackend, private Core::Co
void migrateOwner(const std::string &path, const Common::UserInfo &oldUserInfo, const Common::UserInfo &userInfo, bool isSymlink);
protected:
- virtual bool handleConfigEntry(const Core::ConfigEntry &entry, bool handled);
+ virtual void configure();
virtual void addUser(const Common::UserInfo &userInfo) throw(Core::Exception);
virtual void updateUser(const Common::UserInfo &oldUserInfo, const Common::UserInfo &userInfo) throw(Core::Exception);
virtual void deleteUser(const Common::UserInfo &userInfo) throw(Core::Exception);
public:
- UserConfigBackendHome(Common::Application *application0) : application(application0), homeDir("/home"), dirMode(0755) {
+ UserConfigBackendHome(Common::Application *application0) : application(application0) {
application->getConfigManager()->registerConfigurable(this);
}