configure_user_absence()

Marks one or more users in a workflow organisation as absent or present via wfm.ConfigUserAbsence. The server additionally notifies all running servers and connected enaio® editor-for-workflow instances of the status change.

1. Signature

  • Sync

  • Async

ecm.workflow.configure_user_absence(
    organisation: str | ECMOrganisation,
    absences: Mapping[ECMOrganisationObjectIdLike, bool],
) -> None
await ecm.workflow.configure_user_absence(
    organisation: str | ECMOrganisation,
    absences: Mapping[ECMOrganisationObjectIdLike, bool],
) -> None

The type alias ECMOrganisationObjectIdLike stands for str | ECMOrganisationObject | ECMOrganisationObjectRef — that is, anywhere a GUID is expected, you can also pass an organisation-object instance or reference directly.

2. Parameters

Parameter Type Default Description

organisation

str | ECMOrganisation

Organisation ID as a string or an ECMOrganisation instance.

absences

Mapping[ECMOrganisationObjectIdLike, bool]

Mapping user ID → absence flag. True marks the user as absent, False marks the user as present. Keys may be GUID strings, ECMOrganisationObject, or ECMOrganisationObjectRef instances.

3. Return value

None. Raises an exception when the server job returns an error code.

4. Examples

4.1. Mark a single user as absent

  • Sync

  • Async

org = ecm.workflow.active_organisation()
ecm.workflow.configure_user_absence(
    org,
    {"46E29564BC464929A0A2ECA5387B4855": True},
)
org = await ecm.workflow.active_organisation()
await ecm.workflow.configure_user_absence(
    org,
    {"46E29564BC464929A0A2ECA5387B4855": True},
)

4.2. Toggle multiple users in a single call

  • Sync

  • Async

org = ecm.workflow.active_organisation()
users = {o.name: o for o in ecm.workflow.organisation_objects(org)}

ecm.workflow.configure_user_absence(
    org,
    {
        users["USER_WITH_RIGHTS"]: True,     # absent
        users["USER_WITHOUT_RIGHTS"]: False, # present
    },
)
org = await ecm.workflow.active_organisation()
users = {o.name: o for o in await ecm.workflow.organisation_objects(org)}

await ecm.workflow.configure_user_absence(
    org,
    {
        users["USER_WITH_RIGHTS"]: True,
        users["USER_WITHOUT_RIGHTS"]: False,
    },
)

4.3. Verify with absent_users()

  • Sync

  • Async

org = ecm.workflow.active_organisation()
user_id = "46E29564BC464929A0A2ECA5387B4855"

ecm.workflow.configure_user_absence(org, {user_id: True})
assert user_id in ecm.workflow.absent_users(org)

ecm.workflow.configure_user_absence(org, {user_id: False})
assert user_id not in ecm.workflow.absent_users(org)
org = await ecm.workflow.active_organisation()
user_id = "46E29564BC464929A0A2ECA5387B4855"

await ecm.workflow.configure_user_absence(org, {user_id: True})
assert user_id in await ecm.workflow.absent_users(org)

await ecm.workflow.configure_user_absence(org, {user_id: False})
assert user_id not in await ecm.workflow.absent_users(org)

5. Notes

  • Any number of users can be updated in a single call.

  • The server automatically notifies all other servers and connected enaio® editor-for-workflow instances.

  • Absent users can subsequently be queried via absent_users().

6. See also