Skip to content

Commit c46b91a

Browse files
wixysamclaude
andcommitted
docs(auth): correct updateMe role guidance
The updateMe JSDoc told readers they could set the built-in `role` field and shipped an example that did exactly that. A user reported a 403 "You do not have permission to update user roles" from the live API on 12 Aug 2026. In apper, `UserCRUD.update` pops `role` out of the payload and routes it through `update_user_role`, which requires editor access on the app or platform admin access. An ordinary app user has neither, so the request fails and no other field in the payload is applied. Changes: - Drop the claim that `role` is updatable, and drop `role` from the example so the snippet works when copied. - State that updating `role` needs editor access, rather than listing it as read-only. Owners and editor collaborators genuinely can change it. - Add `collaborator_role` to the protected-field list. The same function discards it silently, with no error at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 4db0eb6 commit c46b91a

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/modules/auth.types.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,25 @@ export interface AuthModule {
144144
/**
145145
* Updates the current authenticated user's information.
146146
*
147-
* You can update `role` and any [custom fields](/developers/backend/resources/entities/user-schema#custom-fields) defined in your
148-
* User entity schema.
149-
* The `role` value must be either `'user'` or `'admin'`.
147+
* You can update any [custom fields](/developers/backend/resources/entities/user-schema#custom-fields)
148+
* defined in your User entity schema.
149+
*
150+
* Updating `role` requires editor access on the app. An app user without it
151+
* gets a 403 response, and none of the other fields in the request are applied.
152+
*
150153
* <Note>
151-
* The following fields are read-only and can't be changed with this method:
152-
* `id`, `email`, `full_name`, `created_date`, `updated_date`, and `created_by`.
154+
* These fields can't be changed with this method:
155+
* `id`, `email`, `full_name`, `created_date`, `updated_date`, `created_by`,
156+
* and `collaborator_role`.
153157
* </Note>
154158
*
155159
* @param data - Object containing the fields to update.
156160
* @returns Promise resolving to the updated user data.
157161
*
158162
* @example
159163
* ```typescript
160-
* // Update role and custom fields defined in your User entity
164+
* // Update custom fields defined in your User entity
161165
* await base44.auth.updateMe({
162-
* role: 'admin',
163166
* bio: 'Software developer',
164167
* preferences: { theme: 'dark' }
165168
* });

0 commit comments

Comments
 (0)