opt backup app

This commit is contained in:
Ivan Office
2024-10-09 21:49:12 +08:00
parent 8b2b329dc2
commit f80e942286
12 changed files with 187 additions and 7 deletions

View File

@@ -15,6 +15,8 @@ class AppAutoBackup(http.Controller):
@http.route("/dbbackup/download/<path:file_path>", type="http", auth="user")
def download_backupfile(self, file_path, **kw):
_logger.warning('download_backupfile: %s', file_path)
if not self.env.user.has_group('base.group_system'):
raise UserError(_('File not found for user.'))
if os.path.exists(file_path):
try:
with open(file_path, 'rb') as file:
@@ -28,4 +30,4 @@ class AppAutoBackup(http.Controller):
except Exception as e:
raise UserError(e)
else:
return 'File not found'
return 'File not found'