.. _UpdateUser: UpdateUser ========== Change a user and revoke their existing sessions. Requires ``access_control.update`` permission, including for your own account. No input or output blobs are used. Parameters ---------- * ``username`` (string, required): existing user. * ``password`` (string, optional): replacement satisfying CreateUser's password rules. * ``email`` (string, optional): replacement; an empty string clears it. * ``add_roles`` / ``remove_roles`` (arrays of strings, optional): role membership changes. Removal wins when a name occurs in both. * ``add_tokens`` (array of strings, optional): complete personal tokens. An addition replaces the token with the same tag. * ``remove_tokens`` (array of strings, optional): tags or complete tokens. Additions are applied after removals. Behavior -------- Omitted fields retain their values. Removing every role leaves the user with no permissions. Token tags are the first 13 characters, including the ``adbp_`` prefix. Every role in the resulting membership must exist. Removing an unassigned role has no effect. Added tokens must contain ``adbp_`` followed by 35 letters or digits; :doc:`GenerateToken` creates valid values. The telemetry account is protected when configured. A successful update revokes all of the user's session and refresh tokens in the same transaction. The current query continues with its starting permissions; the user must authenticate again for subsequent requests. Response -------- Success returns ``status: 0``. Failures return a negative ``status`` and an ``info`` message; see :doc:`../Responses` for error envelopes and retry guidance. Examples -------- .. TESTED_EXAMPLE: UpdateUser_1 .. code-block:: json [{ "UpdateUser": { "username": "john", "add_roles": ["architect"], "remove_roles": ["admin"] } }] Response: .. TESTED_EXAMPLE: UpdateUser_1_response .. code-block:: json [{ "UpdateUser": { "status": 0 } }]