Skip to content

fix: allow null name in admin user creation endpoints#11847

Open
machinelearningprodigy wants to merge 1 commit intoappwrite:1.9.xfrom
machinelearningprodigy:fix-8785-allow-null-user-name
Open

fix: allow null name in admin user creation endpoints#11847
machinelearningprodigy wants to merge 1 commit intoappwrite:1.9.xfrom
machinelearningprodigy:fix-8785-allow-null-user-name

Conversation

@machinelearningprodigy
Copy link
Copy Markdown

What does this PR do?

Allows name: null for the admin user creation endpoints so optional names behave consistently with the internal createUser() handling.

This updates:

  • POST /v1/users
  • POST /v1/users/bcrypt
  • POST /v1/users/md5
  • POST /v1/users/argon2
  • POST /v1/users/sha
  • POST /v1/users/phpass
  • POST /v1/users/scrypt

It also adds an e2e test covering null-name creation across the affected endpoints.

Related issue: #8785

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR updates 7 user-creation endpoints (/v1/users, /v1/users/bcrypt, /v1/users/md5, /v1/users/argon2, /v1/users/sha, /v1/users/phpass, /v1/users/scrypt) to accept null for the name parameter, consistent with the internal createUser() handler which already normalises null to ''.

  • The /v1/users/scrypt-modified endpoint (line 566 in app/controllers/api/users.php) was not updated and still uses new Text(128), which rejects null. The new e2e test loops over all 8 endpoints including scrypt-modified, so that test case will fail with a 400 validation error.

Confidence Score: 4/5

Not safe to merge until the scrypt-modified endpoint param is updated to match the rest.

One P1 defect: the /v1/users/scrypt-modified endpoint was skipped in the param change, causing the bundled e2e test to fail for that case and leaving the fix incomplete.

app/controllers/api/users.php line 566 — scrypt-modified name param needs new Nullable(new Text(128)).

Important Files Changed

Filename Overview
app/controllers/api/users.php Updates 7 of 8 user-creation endpoints to accept null name via Nullable(Text(128)); /v1/users/scrypt-modified (line 566) was not updated and still rejects null.
tests/e2e/Services/Users/UsersConsoleClientTest.php Adds testCreateUserWithNullName covering all 8 endpoints including scrypt-modified; the scrypt-modified case will fail until the corresponding endpoint param is fixed.

Comments Outside Diff (1)

  1. app/controllers/api/users.php, line 566 (link)

    P1 scrypt-modified endpoint missed

    The /v1/users/scrypt-modified endpoint on this line still uses new Text(128), which rejects null. All other endpoints were updated to new Nullable(new Text(128)), but this one was skipped. The new e2e test includes /users/scrypt-modified in its loop and will fail for that entry — sending null for name will produce a 400 validation error instead of 201.

Reviews (1): Last reviewed commit: "fix: allow null name in admin user creat..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant