= users()
:description: Returns all user accounts known to the server (mng.GetUserList). With extended_info=True, additionally loads groups and attributes for each user.
:keywords: users, mng.GetUserList, user accounts, extended_info, ECMUser
:page-tags: api, security

Returns all user accounts known to the server.
With `extended_info=True`, additional fields are populated for each user.

== Signature

[tabs]
====
Sync::
+
[source,python]
----
ecm.security.users(*, extended_info: bool = False) -> list[ECMUser]
----

Async::
+
[source,python]
----
await ecm.security.users(*, extended_info: bool = False) -> list[ECMUser]
----
====

== Parameters

[cols="1,1,3"]
|===
|Parameter |Default |Description

|`extended_info`
|`False`
|When `True`, additionally populates `groups`, `remark`, `valid_from`, and `valid_to`
for each user.
|===

== Return value

List of `ECMUser` instances, one per user account.

=== ECMUser fields

[cols="1,1,3"]
|===
|Field |Type |Description

|`id`
|`int`
|Numeric user ID.

|`username`
|`str`
|Short internal user name.

|`login_name`
|`str`
|Login credential name used for authentication.

|`display_name`
|`str`
|Full display name.

|`email`
|`str`
|E-mail address.

|`guid`
|`str`
|Globally unique identifier of the user account.

|`profile_id`
|`int`
|Profile ID: `-1` = no profile, `0` = user profile, `>0` = assigned profile.

|`locked`
|`bool`
|`True` if the account is locked.

|`remark`
|`str`
|Optional remark from the user configuration. Only populated with `extended_info=True`.

|`valid_from`
|`datetime \| None`
|Account valid-from date. Only populated with `extended_info=True`.

|`valid_to`
|`datetime \| None`
|Account valid-to date. Only populated with `extended_info=True`.

|`groups`
|`list[str]`
|Names of groups the user belongs to. Only populated with `extended_info=True`.
|===

== Examples

=== List all users

[tabs]
====
Sync::
+
[source,python]
----
users = ecm.security.users()
for user in users:
    print(user.username, user.display_name, user.email)
    if user.locked:
        print(f"  → locked")
----

Async::
+
[source,python]
----
users = await ecm.security.users()
for user in users:
    print(user.username, user.display_name, user.email)
----
====

=== Include group membership

[tabs]
====
Sync::
+
[source,python]
----
users = ecm.security.users(extended_info=True)
for user in users:
    print(user.username, user.groups)
----

Async::
+
[source,python]
----
users = await ecm.security.users(extended_info=True)
for user in users:
    print(user.username, user.groups)
----
====

=== Find locked accounts

[tabs]
====
Sync::
+
[source,python]
----
locked = [u for u in ecm.security.users() if u.locked]
print(f"{len(locked)} locked accounts")
----

Async::
+
[source,python]
----
locked = [u for u in await ecm.security.users() if u.locked]
print(f"{len(locked)} locked accounts")
----
====

== See also

* xref:api/security/user.adoc[user()] — Detailed attributes of a single user
* xref:api/security/user_groups.adoc[user_groups()] — Groups of a specific user
