#1052: ScriptDao.kt

projectforge-business/src/main/kotlin/org/projectforge/business/scripting/ScriptDao.kt DAO (Admin Scripts), projectforge-business/src/main/kotlin/org/projectforge/business/scripting/ScriptDao.kt 127 lines · 80 code · 35 comments · 12 blank
DAO for scripts executable by finance/controlling group members. Extends AbstractScriptDao. Provides script backup management (automatic backup on update to disk), backup file retrieval, and history display customization (resolving group/user ID references).

Architecture

Access Control

Restricts access to members of CONTROLLING_GROUP or FINANCE_GROUP via accessChecker.isUserMemberOfGroup.

Script Backup

onUpdate(obj, dbObj) compares script content via Arrays.equals. If changed, copies the old script to scriptBackup field and writes a disk backup to {backupDir}/scripts/script-{id}_{name}_{timestamp}.{ext}. Backups are retrievable via getBackupFiles() which lists both current and legacy naming patterns.

History Formatting

Overrides customizeDisplayHistoryEntry to delegate to historyFormatUtils.replaceGroupAndUserIdsValues, which resolves ID references in history entries to human-readable group/user names.

Git History

868d6abb7 2025 -> 2026
a450b538f History formatting of scripts: users and groups.
63081666f Source file headers: 2024-> 2025.
5989b32fd BaseDao: mechanism of onChangeLister refactored.
3aeda5ef5 Big change: all save|update|...InTrans renamed.
b095e6f7d !!!!! Big change of Transaction handling.
5bafe7941 @Repository -> @Service.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
061f11d59 WIP: sudo scripting
bebba9753 WIP: sudo scripting
2ba9c104f WIP: scripting: download all backups and effective script.
d37760c3e Scripting refactored.
9e7810a92 WIP: Scripting #INCLUDE is now supported.
0bd431bd9 WIP scripting...
97e4bd526 Scripting: pantha rein. ACE editor added.