2022-12-09 13:08:07 +01:00
|
|
|
from .AbstractSplittedSecret import AbstractSplittedSecret
|
|
|
|
class Cleanup(AbstractSplittedSecret):
|
|
|
|
def __init__(self):
|
2022-12-09 13:22:57 +01:00
|
|
|
super(Cleanup, self).__init__()
|
2022-12-09 17:48:37 +01:00
|
|
|
self.encrypted_files_folders = [self.decrypted_group_files_folder,self.decrypted_user_files_folder]
|
|
|
|
self.decrypted_files_folders = [self.encrypted_group_files_folder,self.encrypted_user_files_folder]
|
2022-12-09 17:32:02 +01:00
|
|
|
|
|
|
|
def deleteAllFilesInFolder(self,folder_path):
|
|
|
|
try:
|
|
|
|
self.executeCommand('rm -v ' + folder_path + '*')
|
|
|
|
print(self.getCommandString())
|
|
|
|
print(self.getOutputString())
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def deleteAllDecryptedFiles(self):
|
|
|
|
for folder_path in self.decrypted_files_folders:
|
|
|
|
self.deleteAllFilesInFolder(folder_path)
|
|
|
|
|
2022-12-09 13:22:57 +01:00
|
|
|
def deleteAllEncryptedFiles(self):
|
2022-12-09 17:32:02 +01:00
|
|
|
for folder_path in self.encrypted_files_folders:
|
|
|
|
self.deleteAllFilesInFolder(folder_path)
|
2022-12-09 18:16:31 +01:00
|
|
|
|
|
|
|
def cleanupForUser(self,user):
|
|
|
|
self.executeCommand('find "' + self.encrypted_folder + '" -not -name "*' + str(user) +'*" -type f -print | xargs rm -v')
|
|
|
|
print(self.getCommandString())
|
|
|
|
print(self.getOutputString())
|
|
|
|
|
2022-12-09 17:32:02 +01:00
|
|
|
|
2022-12-09 13:08:07 +01:00
|
|
|
def deleteAll(self):
|
2022-12-09 17:32:02 +01:00
|
|
|
self.deleteAllEncryptedFiles()
|
|
|
|
self.deleteAllDecryptedFiles()
|