mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-01 19:27:59 +00:00
Removing expired links and avatars.
This commit is contained in:
@@ -57,6 +57,9 @@ namespace OpenWifi {
|
||||
if(AuthService()->DeleteUserFromCache(UInfo.email)) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
StorageService()->DeleteAvatar(UserInfo_.userinfo.email,Id);
|
||||
|
||||
Logger_.information(Poco::format("Remove all tokens for '%s'", UserInfo_.userinfo.email));
|
||||
StorageService()->RevokeAllTokens(UInfo.email);
|
||||
Logger_.information(Poco::format("User '%s' deleted by '%s'.",Id,UserInfo_.userinfo.email));
|
||||
|
||||
@@ -33,8 +33,10 @@ namespace OpenWifi {
|
||||
|
||||
void Archiver::onTimer(Poco::Timer &timer) {
|
||||
Poco::Logger &logger = Poco::Logger::get("STORAGE-ARCHIVER");
|
||||
logger.information("Squiggy the DB");
|
||||
logger.information("Squiggy the DB: removing old tokens.");
|
||||
StorageService()->CleanExpiredTokens();
|
||||
logger.information("Squiggy the DB: removing old actionLinks.");
|
||||
StorageService()->CleanOldActionLinks();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ namespace OpenWifi {
|
||||
bool SentAction(std::string &ActionId);
|
||||
bool GetActionLink(std::string &ActionId, SecurityObjects::ActionLink &A);
|
||||
bool GetActions(std::vector<SecurityObjects::ActionLink> &Links, uint64_t Max=200);
|
||||
void CleanOldActionLinks();
|
||||
|
||||
private:
|
||||
int Create_Tables();
|
||||
|
||||
@@ -183,4 +183,19 @@ namespace OpenWifi {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Storage::CleanOldActionLinks() {
|
||||
try {
|
||||
Poco::Data::Session Sess = Pool_->get();
|
||||
Poco::Data::Statement Delete(Sess);
|
||||
|
||||
uint64_t CutOff = std::time(nullptr) - (30 * 24 * 60 * 60);
|
||||
std::string St{"DELETE from ActionLinks where Created<=?"};
|
||||
Delete << ConvertParams(St),
|
||||
Poco::Data::Keywords::use(CutOff);
|
||||
Delete.execute();
|
||||
} catch (const Poco::Exception &E) {
|
||||
Logger_.log(E);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user