Commit 7f5c1ec
authored
feat: Annotate users when givenName and familyName are identical (#529)
## Summary
When users sign up via GitHub with a single-word display name, the
identity provider populates both `givenName` and `familyName` with the
same value. Until now, front-end clients had no reliable signal to
detect this and prompt the user to provide distinct names.
This PR adds annotation-based signalling to the user controller. On
every reconcile, the controller evaluates whether `givenName` equals
`familyName` (both non-empty) and manages the
`iam.miloapis.com/name-review-required: "true"` annotation accordingly —
adding it when the names match, removing it once they differ. The
annotation key is exported as a typed constant in `user_types.go` with
documentation explaining semantics and usage for front-end consumers.
## Changes
- **`pkg/apis/iam/v1alpha1/user_types.go`** — Adds
`UserNameReviewRequiredAnnotation` constant with inline doc comment
covering purpose, expected front-end behavior, value semantics, and a
YAML example.
- **`internal/controllers/iam/user_controller.go`** — Adds
`reconcileNameReviewAnnotation` method and calls it in the main
reconcile loop after `ensureOwnerReferences`.
## Test plan
- [ ] User created via GitHub with a single-word name has the annotation
set after reconciliation
- [ ] Annotation is removed after the user updates their profile with
distinct given and family names
- [ ] User with already distinct names is not annotated
- [ ] No unnecessary API calls when annotation state is already correct
(no-op path)2 files changed
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
134 | 174 | | |
135 | 175 | | |
136 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
0 commit comments