refactor: Ensure admin receives a valid backup encryption key (#22411)

* refactor: Ensure admin receives a valid backup encryption key

- Added logic to retrieve or generate a backup encryption key if not present.

* refactor: simplify code

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
This commit is contained in:
0xsaif 2023-09-15 09:10:10 +03:00 committed by GitHub
parent d43212792d
commit 87c1a9d7d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -626,7 +626,7 @@ def get_backup_path():
@frappe.whitelist()
def get_backup_encryption_key():
frappe.only_for("System Manager")
return frappe.conf.get(BACKUP_ENCRYPTION_CONFIG_KEY)
return get_or_generate_backup_encryption_key()
def get_or_generate_backup_encryption_key():