Repository navigation
fix(ui): let admins edit users created through SAML - #7354
Conversation
|
Claude encountered an error after 2m 55s —— View job I'll analyze this and get back to you. |
a9e4f33 to
166eb60
Compare
|
/review |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
/review |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
Claude encountered an error after 1s —— View job I'll analyze this and get back to you. |
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
Claude finished @luizhf42's task in 3m 23s —— View job Code Review CompleteReviewed 5 files. 2 inline issues posted. Standards: 1 violation, 0 judgement calls. Spec: did not run. Correctness: 1. StandardsThe new tests in CorrectnessIn SpecThe Spec axis did not run. The PR closes shellhub-io/team#278, which is in another repo, and this run cannot read it. Additional notes
If you've addressed the feedback and want a new review, tag |
Users created through SAML have an empty username, and the admin edit form refused every save for them. The schema ran `validateUsername` on the blank value, and the input's native `required` attribute blocked the submit before the schema ran. The modal now derives `usernameRequired` from the user being edited and passes it to both, so a blank username is accepted only for a user who has none. A typed username is still validated, and an existing one still cannot be cleared. The update endpoint keeps the current username when the request sends an empty one, so the payload's `username: ""` leaves the user as is. The description named the user by username and read "Change 's details" for these users. It falls back to the email. `MockModal` now renders `description` so a test can see it. Fixes: shellhub-io/team#278
166eb60 to
0a4d755
Compare
|
/review |
1 similar comment
|
/review |
|
Claude finished @luizhf42's task in 1m 6s —— View job Code Review CompleteI reviewed 5 files for Standards (repo rules, React conventions, tests, code smells) and Correctness (security and runtime defects). No new issues found. The code looks good as-is. The Spec axis did not run. The PR closes shellhub-io/team#278, which is in another repo, and this run cannot read it. Both findings from the previous round are fixed in 0a4d755: the blank-username check now uses |
Closes shellhub-io/team#278
Summary
Users created through SAML have an empty username, and the admin edit form refused every save for them: the schema ran
validateUsernameon the blank value, and the input's nativerequiredattribute blocked the submit before the schema ran.A typed username is still validated, and a user who has a username still cannot clear it. The payload sends
username: "", which the cloud update endpoint keeps as is (shellhub-io/cloud#2631).MockModalnow rendersdescriptionso a test can see it.The issue asked for a
userSchema("edit")unit test. The tests sit at theEditUserModallevel instead, because a schema test can't see the nativerequiredattribute. The e2e case waits for the SAML admin e2e specs.Evidence
Before: in
EditUserModal.test.tsx, "a user without a username" fails 3 tests:After: the file passes all 30 tests. The full console suite, lint (0 errors) and the build pass.
Merge Danger
Door: two-way
Blast Radius: admin
Only the admin user edit modal changes. Create mode is unchanged, because
userSchemaandUserFormFieldsdefault to requiring a username.