User
Model
- class pytm4srv.models.User
- access_level: Mapped[str]
User’s access level (
admin,plan,shop,audit).
- alarm_flash_time: Mapped[timedelta | None]
How long to flash new alarms before considering them “seen” (in seconds).
It is up to the client to implement this behavior.
- default_page: Mapped[str | None]
The page to open when this user logs in or reopens OnTakt.
The default value of
NULLindicates no preference, so it should launch to the default landing page.This can be any string, so it is up to the frontend to set and interpret it.
- developer_mode: Mapped[bool]
Whether this user is interacting directly with the OnTakt API and wishes to see object IDs in the UI.
- favorite_machines: Mapped[List[int]]
A list of machine IDs this user has marked as favorite.
- favorite_reports: Mapped[List[str]]
List of report types this user has marked as favorites.
- favorite_tools: Mapped[List[int]]
A list of tool IDs this user has marked as favorite.
- id: MappedColumn object at 0x79861b52dc60>]]
Unique, numeric ID of this user.
- inventory_display_columns: Mapped[List[str] | None]
The selection and ordering of inventory item attributes to show in the inventory items table in “display” mode when this user is logged in.
The list of available columns is entirely client-dependent, but as of client 2.1.1, the column names are:
Name
Label (en)
typeType
nameName
brandBrand
onHandOn hand
onOrderOn order
durableUsage type
actionsActions
- inventory_order_columns: Mapped[List[str] | None]
The selection and ordering of inventory item attributes to show in the inventory items table in “order” mode when this user is logged in.
The list of available columns is entirely client-dependent, but as of client 2.1.1, the column names are the same as
inventory_display_columnswith the addition of:Name
Label (en)
totalConsumedUsed per day
leadTimeLead time (days)
minOnHandMin. on-hand qty.
safetyStockSafety stock (days)
orderQtyQuantity to order
pricePrice
suppliersSuppliers
- is_active: Mapped[bool]
Whether this user is allowed to log in.
- issues_table_columns: Mapped[List[str] | None]
The selection and ordering of attributes to show in the issues table when this user is logged in.
The list of available columns is entirely client-dependent, but as of client 2.3.8, the column names are:
Name
Label (en)
idID
priorityPriority
nameName
descriptionDescription
tagsTags
timestampStart
endEnd
machineMachine
equipmentEquipment
totalDowntimeDowntime
totalValueValue
userUser
actionsActions
- kudos_emoji: Mapped[str]
The emoji to show when this user has +1’d a note. Only UTF-8 (single-byte) emoji are supported.
- machines_table_columns: Mapped[List[str] | None]
The selection and ordering of machine attributes to show in the machines table when this user is logged in.
The list of available columns is entirely client-dependent, but as of client 2.3.8, the column names are:
Name
Label (en)
idID
nameName
descriptionDescription
tagsTags
statusCurrent status
cycleStateCycle state
estoppedEmergency stopped
processProcess
programProgram
shiftShift
lastNCContactLast contact (NC)
lastTMACContactLast contact (TMAC)
oeeOEE
feedRateOverrideFeed rate override
workOrderWork order
utilizationUtilization
displayVariableDisplay variables
actionsActions
- machines_table_view: Mapped[bool]
Whether this user prefers the table view for the machines page. Implementation is up to the client.
- machines_view_options: Mapped[Dict[str, Any]]
Sort and filter settings for viewing a list of machines.
The values stored here are entirely client-dependent, but client 2.2.1 uses the following properties:
sortBystring: one of"default": use the machines’sort_indexproperty"name": sort by name alphabetically"status": machines are sorted into the following order:Machines with TMAC alarms
Machines in feed hold states
Machines in optional stop states
Machines that are emergency stopped
Machines in active states
Machines that have not yet reported (
cycle_state_idis null)All other machines
"display_var": value of the active process’s display variable"gap_now": difference between goal and part count at the current time"gap_eos": difference between goal and predicted part count at the end of the shift
tagsstring array: machines with any of the selected tags will be displayedexcludeStatesint array: machines in any of these state definition IDs will not be displayed.The client uses some special values in this array to exclude machines based on other properties: -
-1: Not yet reported (cycle_state_idis null) --2: Emergency stopped (estoppedis true)
favoritesOnlyboolean: only the current user’s favorite machines will be displayedshowArchiveboolean: only archived machines will be displayedtableModeboolean: show the machines in a table instead of cards
- maintenance_view_options: Mapped[Dict[str, Any]]
Sort and filter settings for viewing a list of maintenance items.
The values stored here are entirely client-dependent, but client 2.4.3 uses the following properties:
sortBystring: one of"id""itemType""difficulty""name""interval""nextDue""machine""equipment"
descendingboolean: reverse sortBymodestring:"all","shop","machine", or"equipment"machineIdintequipmentIdintinventoryItemIdintitemTypestring:"*","task", or"measurement"overdueOnlybooleancriticalOnlybooleandifficultieslist of int
- password: Mapped[str]
Hashed password.
- presentation_mode: Mapped[bool]
Whether this user has turned on “presentation mode”.
When true, the client should not automatically open popups that might interfere with a kiosk-type display, such as the release notes window after each update.
- production_chart_options: Mapped[Dict[str, Any]]
Chart display configuration.
The values stored here are entirely client-dependent, but client 2.3.4 uses a
layersproperty with boolean sub-properties for each layer of:partstmacEventsncAlarms(off by default)toolReplacements(off by default)trendsfeedRate(off by default)downtimeshifts(off by default)
Whether this user has turned on “screenshare mode”.
When true, the client should not show real program or process names.
- show_display_variables: Mapped[bool]
Whether to show variables selected for display by the active process on the machine card color chips.
It is up to the client to implement this behavior.
- tool_replacements_table_columns: Mapped[List[str] | None]
The selection and ordering of attributes to show in the tool replacement (tool history) table when this user is logged in.
The list of available columns is entirely client-dependent, but as of client 2.1.21, the column names are:
Name
Label (en)
idID
timestampTimestamp
userUser
partCountParts
runtimeRun time
dayCountDays
reasonReason
conditionCondition
indexedIndexed
tmacJobTMAC job
substituteSubstitute
notesNotes
imageImage
invItemInventory item
actionsActions
- tools_table_columns: Mapped[List[str] | None]
The selection and ordering of tool attributes to show in the tools table when this user is logged in.
The list of available columns is entirely client-dependent, but as of client 2.0.4, the column names are:
Name
Label (en)
locationLocation
nameName
typeType
assemblyAssembly
partNumberPart number
usageUsage
partLifeExpected life (parts)
averageLifeAverage life (parts)
lifeDiffLife improvement (parts)
notesNotes
stickOutStick out
torqueSpecTorque spec.
machineMachine
actionsActions
Setting this field to
NULLwill cause the client to use its default column configuration. Setting this field to an array of column names will set only the listed columns visible in the specified order.
- username: Mapped[Username]
Unique name of this user.
Endpoints
- GET /api/users/
Get a list of all registered users.
- Returns:
an object mapping user ID to user object.
- GET /api/users/(int: user_id)
Get a single user’s details, including a list of their API keys.
- Returns:
a single user object
- Status Codes:
404 Not Found – if the user does not exist
- PUT /api/users/
Create a new user.
- Reqjson:
a user object
- Status Codes:
400 Bad Request – if any fields are missing or invalid
409 Conflict – if the username is already taken
201 Created – on success
- Returns:
the new user object
- PATCH /api/users/(int: user_id)
Edit an existing user.
- Parameters:
user_id – the ID the user to edit.
- Status Codes:
400 Bad Request – if the user data is invalid
404 Not Found – if the user does not exist
- Returns:
the modified user object
- DELETE /api/users/(int: user_id)
Delete an existing user.
- Parameters:
user_id – the ID of the
Userto delete.
- Status Codes:
404 Not Found – if the user does not exist
204 No Content – on success
- PUT /api/users/keys
Create a new API key for the current user.
- Request JSON Object:
name (string) – name for the new API key
- Resjson:
an
APIKeyobject with thekeyproperty set to the newly-generated API key. This value will never be available in plaintext again.- Status Codes:
201 Created – on success
400 Bad Request – if the name is not provided
- DELETE /api/users/keys/(int: api_key_id)
Delete an existing API key. Deleting an API key will stop it from working forever.
- Parameters:
api_key_id – the ID of the
APIKeyto delete.
- Status Codes:
204 No Content – on success
403 Forbidden – if the current user is not the owner of the API key or an administrator
404 Not Found – if the key does not exist