Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b7eed51
test: add integration test for LDAP user login persistence
lannuttia Jul 14, 2026
59edbbb
refactor: improve LDAP user test organization and clarity
lannuttia Jul 14, 2026
c3ff185
feat: use pwd::Passwd::from_uid() for LDAP user lookup
lannuttia Jul 14, 2026
4da250e
fix: use pwd::Passwd::from_uid() for LDAP user login persistence
lannuttia Jul 14, 2026
fcbc508
feat: display full name for users not in user_datas
lannuttia Jul 14, 2026
4f33f06
refactor: eliminate user_datas Vec, use UID-based HashMap lookups
lannuttia Jul 14, 2026
43372f4
fix: load wallpapers for users not in user_configs
lannuttia Jul 14, 2026
1ac97ba
refactor: simplify wallpaper loading test and remove unwrap
lannuttia Jul 14, 2026
03f71ee
feat: initialize wallpaper for selected user during app startup
lannuttia Jul 14, 2026
721337b
chore: remove unneeded test file
lannuttia Jul 14, 2026
4f32441
refactor: remove wallpaper-related test code
lannuttia Jul 14, 2026
0dc9477
test: add resolve_uid_for_username helper and test
lannuttia Jul 14, 2026
290e373
refactor: replace duplicated passwd lookups with resolve_uid_for_user…
lannuttia Jul 14, 2026
2fbd6f2
test: add get_selected_user_config helper and test
lannuttia Jul 14, 2026
d0e233b
refactor: replace duplicated user_configs accessors with get_selected…
lannuttia Jul 14, 2026
c5e4c3a
feat: cache display name in SelectedUser struct
lannuttia Jul 14, 2026
42dc740
refactor: remove dead code wrapper and migrate tests to v2 API
lannuttia Jul 14, 2026
7efc56d
fix: address 10 actionable code review issues
lannuttia Jul 14, 2026
dbd7205
refactor: rename get_selected_user_config → selected_user_config
lannuttia Jul 14, 2026
08fb815
refactor: rename user_datas_vec → users
lannuttia Jul 14, 2026
62e44fb
test: replace truthiness check with exact GECOS assertion
lannuttia Jul 14, 2026
8ba2f6f
test: delete zero-value test_selected_user_caches_display_name
lannuttia Jul 14, 2026
ea973a9
perf: defer make_selected_user() from keystroke to submit
lannuttia Jul 14, 2026
0cecae8
chore: remove unneeded mut
lannuttia Jul 14, 2026
6d91866
refactor: rename selected_username → selected_user
lannuttia Jul 14, 2026
642df3e
test: add boundary case for determine_username with no last_user and …
lannuttia Jul 14, 2026
48934e9
test: add boundary case for get_display_name with nonexistent user
lannuttia Jul 14, 2026
60bee73
test: split test_selected_user_config into 3 focused tests
lannuttia Jul 14, 2026
8b9409a
test: add username_to_uid reverse index for O(1) lookups
lannuttia Jul 14, 2026
605722d
perf: replace O(n) linear scan with O(1) HashMap lookup in make_selec…
lannuttia Jul 14, 2026
11bd240
refactor: rename determine_username_from_last_user → resolve_last_user
lannuttia Jul 14, 2026
0c8dd49
refactor: extract gecos parsing to shared utility
lannuttia Jul 14, 2026
332cb3f
docs: fix user_configs comment - uses passwd fallback, not empty
lannuttia Jul 14, 2026
32e0fb7
test: replace HashMap mechanics test with real index-building test
lannuttia Jul 14, 2026
055d96d
docs: remove 'how' comments, keep only 'why'
lannuttia Jul 14, 2026
7b86630
test: rename test_determine_username_from_last_user_* → test_resolve_…
lannuttia Jul 14, 2026
54d45af
test: delete over-engineered selected_user_config tests
lannuttia Jul 14, 2026
562678b
refactor: use Option<&str> instead of Option<String> in parse_full_na…
lannuttia Jul 14, 2026
b69cd8a
test: add missing edge case for resolve_last_user(None, non_empty_con…
lannuttia Jul 14, 2026
a382df3
docs: remove 'how' comments that narrate code
lannuttia Jul 14, 2026
8ce2225
chore: apply formatting changes
lannuttia Jul 14, 2026
b3dd0ae
Merge branch 'origin/master' into fix/last-user-unknown
lannuttia Jul 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions daemon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,17 @@ impl UserData {
}
}

/// Extract full name from gecos (gecos format: name,room,work-phone,home-phone,other)
pub fn parse_full_name_from_gecos(gecos: Option<&str>) -> String {
gecos
.and_then(|gecos| gecos.split(',').next())
.map(|x| x.to_string())
.unwrap_or_default()
}

impl From<pwd::Passwd> for UserData {
fn from(user: pwd::Passwd) -> Self {
let mut full_name = user
.gecos
.as_ref()
.and_then(|gecos| gecos.split(',').next())
.map(|x| x.to_string())
.unwrap_or_default();
let mut full_name = parse_full_name_from_gecos(user.gecos.as_deref());
if full_name.is_empty() {
full_name = user.name.clone();
}
Expand All @@ -283,3 +286,29 @@ impl From<pwd::Passwd> for UserData {
}
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_parse_full_name_from_gecos() {
// Standard gecos with full name as first field
assert_eq!(
parse_full_name_from_gecos(Some("John Doe,Room 123,555-1234")),
"John Doe"
);

// Gecos with only name
assert_eq!(
parse_full_name_from_gecos(Some("Alice Smith")),
"Alice Smith"
);

// Empty gecos
assert_eq!(parse_full_name_from_gecos(Some("")), "");

// None gecos
assert_eq!(parse_full_name_from_gecos(None), "");
}
}
Loading