#1118: UserDao.kt

projectforge-business/src/main/kotlin/org/projectforge/business/user/UserDao.kt Data Access Object, projectforge-business/src/main/kotlin/org/projectforge/business/user/UserDao.kt 358 lines · 233 code · 94 comments · 31 blank
Core DAO for user entity persistence, providing user lookup by various criteria (username, email, ID), authentication queries, and user CRUD operations with access control.

Architecture

Inheritance

Extends BaseDao. Adds user-specific queries: findByUsername(), findByEmail(), findActiveUsers(), authenticate() (password verification).

Security Integration

Implements access checks: only admins can see all users; regular users see themselves and users in shared groups. Updates trigger cache invalidation on UserGroupCache and UserPrefCache.

Design Rationale

Core user persistence is centralized here to ensure consistent password hashing, status checks, and access control enforcement across all user operations.

Architecture Analysis

Resides in projectforge-business, the core module containing domain logic, services, and persistence. Typically annotated with @Service or @Component, managed by the Spring IoC container with dependency injection.

Git History

CommitWhat changed
868d6abb752025 -> 2026
11dbfab8c3Userright handling in PFUserDO and UserGroupCache improved (rights of user may not be initialized).
63081666f6Source file headers: 2024-> 2025.
bbc198d030Migration stuff in progress... (all tests of all packages: OK).
4bc37b3a14Migration stuff in progress...
9e3c523c75Migration stuff in progress... (all tests of all packages: OK).
c97135a57dMigration stuff in progress...
d18c899b51Refactoring of history entries, FlatDisplayHistoryEntries and DisplayHistoryEntries...
b79a1edca5Migration stuff in progress... (all tests of all packages: OK).
d67bce18b9Migration stuff in progress...
5989b32fdbBaseDao: mechanism of onChangeLister refactored.
1b50060c3aBaseDao: renamed: get -> find, save -> insert, getList -> select, load -> select
87aaf6a5a5Migration stuff in progress... BaseDao refactored (not yet finished) internal* methods renamed.
3aeda5ef5aBig change: all save|update|...InTrans renamed (InTrans removed). PfPesistenceContext as param not needed anymore (ThreadLocal is used instead). (all tests of all packages: OK).
67805f2fc1ThreadLocalUserContext.user -> ThreadLocalUserContext.loggedInUser (renamed for avoiding mis-understandings in code).
9e30522ba4Migration stuff in progress... (all tests of all packages: OK).
85b4e11758PfPersistenceService and PfPersistenceContext: query renamed to executeQuery.
f8e614f12aDisplayHistoryEntry: new concept in progress...
68688c1484DisplayHistoryEntry: new concept in progress...
1135ccbca9Persistence: functions renamed: *NewTrans -> *InTrans
108ecf6296!!!!! Big change of Transaction handling: Re-uses PfPersistenceContext as much as possible (not yet finished). Tests doesn't yet run. readonly-Transactions in PfPersistenceService removed, write-operations of PfPersistenceService removed.
b095e6f7d1!!!!! Big change of Transaction handling: Re-uses PfPersistenceContext as much as possible (not yet finished). Tests doesn't yet run.
f59810cf03Migration stuff in progress...
4c04cfd652MAJOR-CHANGE! Migration of integer id's to Long id's (including fk's etc.)
5bafe79416@Repository -> @Service. @Transactional-Annotations removed.
ee7b7fe158Migration stuff in progress...
f2f7cff74aMigration stuff in progress...
0d183e5df7Migration stuff in progress...
9d8b94352eMigration stuff in progress...
a2f3f99b2eMigration stuff in progress...
67ce75fe95Migration stuff in progress...
e33c8b9c20Migration stuff in progress...