Werk #16137: user_config: allow update of custom user attributes
Komponente | REST API | ||||
Titel | user_config: allow update of custom user attributes | ||||
Datum | 26.09.2023 | ||||
Level | Kleine Änderung | ||||
Klasse | Bugfix | ||||
Kompatibilität | Inkompatibel - Manuelle Interaktion könnte erforderlich sein | ||||
Checkmk versions & editions |
|
This werk addresses an issue reported, where you could create a user with custom attributes, but you could not update the user's custom attributes.
E.g.
Calling this endpoint with the following payload would work, providing the custom attribute 'attr_1' exists.
POST check_mk/api/v1/domain-types/user_config/collections/all
{
"username": "user_1",
"fullname": "user_1",
"auth_option": {
"auth_type": "password",
"password": "password_with_at_least_12_characters"
},
"disable_login": false,
"contact_options": {
"email": "user@example.com"
},
"pager_address": "",
"idle_timeout": {"option": "global"},
"roles": ["user"],
"authorized_sites": ["heute"],
"contactgroups": ["all"],
"disable_notifications": {"disable": false},
"language": "de",
"temperature_unit": "celsius",
"interface_options": {
"interface_theme": "dark"
}
"attr_1": "some_text",
}
However, attempting to modify this user with the edit user endpoint
PUT check_mk/api/v1/objects/user_config/user_1
{
"attr1": "edited_text"
}
would fail and return a response like so
{
"title": "Bad Request",
"status": 400,
"detail": "These fields have problems: _schema",
"fields": {
"_schema": [
"Unknown Attribute: 'attr_1'"
]
}
}
We now check for custom user attributes on the update endpoint and allow them if they exist, just like the create user endpoint.