fosKeyMan
|
Handle keyfile operations related to activation and deactivation, as well as reading keyfiles from directories. More...
Public Member Functions | |
__init__ (self, activated_path, deactivated_path, trash_path) | |
Initialize the KeyHandler with the paths for activated and deactivated directories. | |
activate_key (self, key_file) | |
Move a keyfile from the deactivated directory to the activated directory. | |
check_directories (self) | |
Check if both the activated and deactivated directories exist. | |
deactivate_key (self, key_file) | |
Move a keyfile from the activated directory to the deactivated directory. | |
delete_key (self, key_file) | |
Move a keyfile from either the activated or deactivated directory into the trash directory. | |
key_folder_path (self, serial_number, status) | |
Find the folder path containing the given serial number by searching through the userProperties.json files. | |
permanently_delete_key (self, key_file) | |
Permanently delete a keyfile folder from the trash directory. | |
read_keys (self, status) | |
Read and return a list of serial numbers from userProperties.json files within the folders in the specified base directory. | |
undo_delete_key (self, key_file) | |
Restore a keyfile from the trash directory to the deactivated directory. | |
Public Attributes | |
activated_path = activated_path | |
deactivated_path = deactivated_path | |
trash_path = trash_path | |
Handle keyfile operations related to activation and deactivation, as well as reading keyfiles from directories.
The KeyHandler manages two directories: one for activated keyfiles and one for deactivated keyfiles. It provides methods to check if the directories exist, read keyfiles, and move keyfiles between activated and deactivated directories.
Definition at line 15 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.__init__ | ( | self, | |
activated_path, | |||
deactivated_path, | |||
trash_path ) |
Initialize the KeyHandler with the paths for activated and deactivated directories.
activated_path | (str): The file path where activated keyfiles are stored. |
deactivated_path | (str): The file path where deactivated keyfiles are stored. |
Definition at line 22 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.activate_key | ( | self, | |
key_file ) |
Move a keyfile from the deactivated directory to the activated directory.
key_file | (str): The name of the keyfile (without extension) to activate. |
Definition at line 78 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.check_directories | ( | self | ) |
Check if both the activated and deactivated directories exist.
Definition at line 32 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.deactivate_key | ( | self, | |
key_file ) |
Move a keyfile from the activated directory to the deactivated directory.
key_file | (str): The name of the keyfile (without extension) to deactivate. |
Definition at line 92 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.delete_key | ( | self, | |
key_file ) |
Move a keyfile from either the activated or deactivated directory into the trash directory.
key_file | (str): The folder name of the keyfile to delete. |
Definition at line 106 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.key_folder_path | ( | self, | |
serial_number, | |||
status ) |
Find the folder path containing the given serial number by searching through the userProperties.json files.
serial_number | (str): The serial number to locate. |
status | (str): 'activated' or 'deactivated' to determine the base directory. |
Definition at line 161 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.permanently_delete_key | ( | self, | |
key_file ) |
Permanently delete a keyfile folder from the trash directory.
key_file | (str): The folder name of the keyfile to delete. |
Definition at line 148 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.read_keys | ( | self, | |
status ) |
Read and return a list of serial numbers from userProperties.json files within the folders in the specified base directory.
status | (str): 'activated' or 'deactivated'. Uses the activated_path or deactivated_path as the base directory. |
Definition at line 45 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.undo_delete_key | ( | self, | |
key_file ) |
Restore a keyfile from the trash directory to the deactivated directory.
key_file | (str): The folder name of the keyfile to restore. |
Definition at line 130 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.activated_path = activated_path |
Definition at line 28 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.deactivated_path = deactivated_path |
Definition at line 29 of file keyhandler.py.
src.backend.keyhandler.KeyHandler.trash_path = trash_path |
Definition at line 30 of file keyhandler.py.