From 86e5f80837ad55932f2469d79d9e6b6bb07cf5ed Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 28 Sep 2009 19:09:22 +0200 Subject: Implemented new ConfigManager --- src/modules/AuthProviderFile/AuthProviderFile.cpp | 34 ++++------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'src/modules/AuthProviderFile/AuthProviderFile.cpp') diff --git a/src/modules/AuthProviderFile/AuthProviderFile.cpp b/src/modules/AuthProviderFile/AuthProviderFile.cpp index 177d633..4522092 100644 --- a/src/modules/AuthProviderFile/AuthProviderFile.cpp +++ b/src/modules/AuthProviderFile/AuthProviderFile.cpp @@ -88,33 +88,9 @@ void AuthProviderFile::readFile(const std::string &name) { } } -bool AuthProviderFile::handleConfigEntry(const Core::ConfigEntry &entry, bool /*handled*/) { - if(!entry[0].getKey().matches("AuthProviderFile")) - return false; +void AuthProviderFile::configure() { + filehash = application->getConfigManager()->get("AuthProviderFile.Hash"); - if(entry[1].isEmpty()) - return true; - - if(entry[1].getKey().matches("Hash")) { - if(entry[2].isEmpty()) { - filehash = entry[1][0]; - - if(!Common::Hash::isHashSupported(filehash)) - application->logf(Core::Logger::LOG_WARNING, "AuthProviderFile: Unsupported hash '%s'", filehash.toLocale().c_str()); - } - } - else if(entry[1].getKey().matches("File")) { - if(entry[2].isEmpty()) { - files.push_back(entry[1][0]); - } - } - else if(!entry[2].isEmpty()) - return false; - - return true; -} - -void AuthProviderFile::configFinished() { if(filehash.isEmpty() || filehash.matches("clear")) { hashes = Common::Hash::getHashList(); filehash.remove(); @@ -126,8 +102,10 @@ void AuthProviderFile::configFinished() { hashes.push_back("Clear"); - for(std::vector::iterator file = files.begin(); file != files.end(); ++file) - readFile(file->toLocale()); + std::vector fileEntries = application->getConfigManager()->getEntries("AuthProviderFile.File"); + for(std::vector::iterator fileEntry = fileEntries.begin(); fileEntry != fileEntries.end(); ++fileEntry) { + readFile((*fileEntry)->getValue().toLocale()); + } } bool AuthProviderFile::checkPassword(const Core::String &user, const std::vector &data, const Core::String &hash) throw(Core::Exception) { -- cgit v1.2.3