create_user()
Creates a new user account on the ECM server.
Server-assigned fields (id, guid) are populated in the returned object.
|
Empirically only
|
1. Signature
-
Sync
-
Async
ecm.security.create_user(
username: str,
*,
login_name: str | None = None,
display_name: str = "",
email: str = "",
remark: str = "",
password: str = "",
plain_password: bool = False,
profile_id: int = -1,
locked: bool = False,
supervisor: bool = False,
account_type: int = 0,
flags: int = 0,
lang_id: int = 0,
server_id: int = 0,
valid_from: datetime | None = None,
valid_to: datetime | None = None,
change_pwd: bool = False,
never_expire: bool = False,
) -> ECMUserAttributes
await ecm.security.create_user(...) -> ECMUserAttributes
2. Parameters
| Parameter | Default | Description |
|---|---|---|
|
— |
Internal user name ( |
|
|
Login credential name; defaults to |
|
|
Full display name. |
|
|
E-mail address. |
|
|
Optional remark. |
|
|
Plaintext password. Auto-encoded into the Blue server scheme via |
|
|
When |
|
|
If |
|
|
If |
|
|
|
|
|
Whether the account starts locked. |
|
|
Grant supervisor rights (XML value |
|
|
|
|
|
|
|
|
Language ID; |
|
|
Home server ID. |
|
|
Account valid-from timestamp. |
|
|
Account valid-to timestamp. |
4. Errors
-
ECMException(or subclass) — when the server rejects the creation, e.g. on duplicate user name.
5. Examples
5.1. Minimal call
-
Sync
-
Async
user = ecm.security.create_user("john", display_name="John Doe", email="j@x.de")
print(user.guid, user.id)
user = await ecm.security.create_user("john", display_name="John Doe")
5.2. Time-limited account with supervisor rights
from datetime import datetime
user = ecm.security.create_user(
"contractor1",
display_name="External Contractor",
email="c@partner.com",
supervisor=True,
valid_from=datetime(2026, 1, 1),
valid_to=datetime(2026, 12, 31, 23, 59, 59),
)
5.3. Plaintext password (recommended)
user = ecm.security.create_user("john", password="S3cret!")
# The user can log in with "S3cret!" — encoding happens automatically.
5.4. ECMIND_KEY-encrypted password
When the ECMIND_KEY environment variable is set, the password may be passed
base85+XOR-encrypted — password_reveal() decrypts it transparently before the
Blue encoding step:
import os
os.environ["ECMIND_KEY"] = "shared-key"
# Assume "ENCRYPTED..." was encrypted with ECMIND_KEY:
user = ecm.security.create_user("john", password="ENCRYPTED...")
6. See also
-
update_user() — Modify attributes
-
delete_user() — Delete account
-
add_user_to_group() — Group association
-
user() — Read detailed attributes