update_user()

Updates an existing user account. Fields not passed are read from the server first and rewritten unchanged so they are preserved.

1. Signature

  • Sync

  • Async

ecm.security.update_user(
    user_guid: str,
    *,
    username: str | None = None,
    login_name: str | None = None,
    display_name: str | None = None,
    email: str | None = None,
    remark: str | None = None,
    password: str | None = None,
    profile_id: int | None = None,
    locked: bool | None = None,
    supervisor: bool | None = None,
    account_type: int | None = None,
    flags: int | None = None,
    lang_id: int | None = None,
    server_id: int | None = None,
    valid_from: datetime | None = None,
    valid_to: datetime | None = None,
    change_pwd: bool | None = None,
    never_expire: bool | None = None,
) -> ECMUserAttributes
await ecm.security.update_user(...) -> ECMUserAttributes

2. Parameters

Parameter Default Description

user_guid

GUID of the user to update.

all others

None

If not None, the value is changed. None keeps the current value.

password

None

Plaintext password. Auto-encoded via password_encrypt() into the Blue server scheme before sending (with optional password_reveal() for ECMIND_KEY-encrypted values). None keeps the existing password unchanged.

3. Return value

ECMUserAttributes reflecting the updated state (re-fetched from the server).

4. Errors

  • ECMNotFoundException — when user_guid does not match any user.

  • ECMException (or subclass) on other server failures.

5. Examples

5.1. Lock an account

  • Sync

  • Async

ecm.security.update_user(user.guid, locked=True)
await ecm.security.update_user(user.guid, locked=True)

5.2. Change e-mail and display name

ecm.security.update_user(
    user.guid,
    email="new@example.com",
    display_name="John Q. Doe",
)

5.3. Extend validity

from datetime import datetime

ecm.security.update_user(
    user.guid,
    valid_to=datetime(2027, 12, 31, 23, 59, 59),
)

6. See also