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
NULL
indicates 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 0x7b8293731c60>]]
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)
type
Type
name
Name
brand
Brand
onHand
On hand
onOrder
On order
durable
Usage type
actions
Actions
- 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_columns
with the addition of:Name
Label (en)
totalConsumed
Used per day
leadTime
Lead time (days)
minOnHand
Min. on-hand qty.
safetyStock
Safety stock (days)
orderQty
Quantity to order
price
Price
suppliers
Suppliers
- 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)
id
ID
priority
Priority
name
Name
description
Description
tags
Tags
timestamp
Start
end
End
machine
Machine
equipment
Equipment
totalDowntime
Downtime
totalValue
Value
user
User
actions
Actions
- 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)
id
ID
name
Name
description
Description
tags
Tags
status
Current status
cycleState
Cycle state
estopped
Emergency stopped
process
Process
program
Program
shift
Shift
lastNCContact
Last contact (NC)
lastTMACContact
Last contact (TMAC)
oee
OEE
feedRateOverride
Feed rate override
workOrder
Work order
utilization
Utilization
displayVariable
Display variables
actions
Actions
- 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:
sortBy
string: one of"default"
: use the machines’sort_index
property"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_id
is 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
tags
string array: machines with any of the selected tags will be displayedexcludeStates
int 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_id
is null) --2
: Emergency stopped (estopped
is true)
favoritesOnly
boolean: only the current user’s favorite machines will be displayedshowArchive
boolean: only archived machines will be displayedtableMode
boolean: 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:
sortBy
string: one of"id"
"itemType"
"difficulty"
"name"
"interval"
"nextDue"
"machine"
"equipment"
descending
boolean: reverse sortBymode
string:"all"
,"shop"
,"machine"
, or"equipment"
machineId
intequipmentId
intinventoryItemId
intitemType
string:"*"
,"task"
, or"measurement"
overdueOnly
booleancriticalOnly
booleandifficulties
list 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
layers
property with boolean sub-properties for each layer of:parts
tmacEvents
ncAlarms
(off by default)toolReplacements
(off by default)trends
feedRate
(off by default)downtime
shifts
(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)
id
ID
timestamp
Timestamp
user
User
partCount
Parts
runtime
Run time
dayCount
Days
reason
Reason
condition
Condition
indexed
Indexed
tmacJob
TMAC job
substitute
Substitute
notes
Notes
image
Image
invItem
Inventory item
actions
Actions
- 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)
location
Location
name
Name
type
Type
assembly
Assembly
partNumber
Part number
usage
Usage
partLife
Expected life (parts)
averageLife
Average life (parts)
lifeDiff
Life improvement (parts)
notes
Notes
stickOut
Stick out
torqueSpec
Torque spec.
machine
Machine
actions
Actions
Setting this field to
NULL
will 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
User
to 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
APIKey
object with thekey
property 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
APIKey
to 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