userdb: add birthDate field to JSON user records

Add a birthDate field to the JSON user record, stored internally as a
struct tm with INT_MIN/negative sentinels for unset fields. The field
is serialized as a YYYY-MM-DD string in JSON and validated via
parse_birth_date(), which shares its core logic with
parse_calendar_date() through a new parse_calendar_date_full()
function.

For birth dates, timegm() is called directly (rather than
mktime_or_timegm_usec) to support pre-epoch dates. The wday field is
used to distinguish timegm() failure from a valid (time_t) -1 return.

birthDate is excluded from user_record_self_modifiable_fields(), so
only administrators can set or change it via homectl. The field
remains in the regular (non-privileged) JSON section, keeping it
readable by the user and applications.
This commit is contained in:
Dylan M. Taylor
2026-03-18 17:33:22 -04:00
parent 770958e24a
commit 7a858878a0
10 changed files with 148 additions and 9 deletions
+3
View File
@@ -273,6 +273,9 @@ This must be a string, and should follow the semantics defined in the
It's probably wise to use a location string processable by geo-location subsystems, but this is not enforced nor required.
Example: `Berlin, Germany` or `Basement, Room 3a`.
`birthDate` → A string in ISO 8601 calendar date format (`YYYY-MM-DD`) indicating the user's date
of birth. The earliest representable year is 1900. This field is optional.
`disposition` → A string, one of `intrinsic`, `system`, `dynamic`, `regular`,
`container`, `foreign`, `reserved`. If specified clarifies the disposition of the user,
i.e. the context it is defined in.