Werk #16137: user_config: allow update of custom user attributes

Component REST API
Title user_config: allow update of custom user attributes
Date Sep 26, 2023
Level Trivial Change
Class Bug Fix
Compatibility Incompatible - Manual interaction might be required
Checkmk versions & editions
2.3.0b1 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)
2.2.0p11 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

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.

To the list of all Werks