Modify Mapping Configuration¶
POST /api/v1/login_mapping/field/{lgmp_uuid}/modify
Overview¶
Fully updates a custom login mapping rule in this workspace.
Before Calling and Usage Steps¶
This group maintains Deployment Plan custom login attribute mappings with isSystem=false in the current workspace. These are different from SAML mappings bound to identity providers by ssoUUID, and from External/Inner system mappings. Actual effect also requires the workspace to enable isOpenCustomMappingRule; you can configure the switch and verify the login policy in Custom Mapping. Save/delete only changes the rule; it does not immediately change roles for existing members or revoke existing sessions. Subsequent LDAP/OIDC shared login flows rematch based on the actual userinfo.
Matching uses top-level userinfo attributes: arrays are compared element by element as str(value), and other values are compared in Python string form. Fields and values use database equality semantics (case sensitivity/collation is determined by the deployment database); no regex/contains or nested path extraction is performed. Use only stable strings from the identity source. Roles from multiple matching rules are unioned, then available roles are filtered. When the workspace custom switch is enabled, it takes precedence over system rules: a match usually resets roles, and no match may clear the original association; existing Owner roles have protection logic. First verify actual permissions with a dedicated test identity; do not assume that the next login's roles are correct solely because this HTTP request succeeds.
All three business fields must be submitted completely; targetValues replaces the entire old role set and does not append or merge. The UUID does not change; converting this custom rule to system or moving it to another workspace is not supported. After some invalid roles are filtered out, the request may succeed; you must read back targetValues and roleInfos to confirm. [] is not a clear command; it returns 404 because there are no role records. If all matched records are soft-deleted roles, an empty set may be saved; do not treat it as a usable configuration.
Route Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| lgmp_uuid | string | Y | This is not a role, SSO provider, or SAML fdmp_ mapping UUID.Example: lgmp_exampleHow to obtain or fill: Get the current workspace's lgmp_ record from content.data[].uuid in the Rule List. |
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | The workspace's OpenAPI authentication credential. Example: <DF-API-KEY>How to obtain or fill: Obtain an OpenAPI Key with the required permission from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| targetValues[*] | string | A single string, not a role display name; array elements are not uniformly strongly typed, an incorrect shape may cause 500, and do not submit objects or nested arrays. Example: generalHow to obtain or fill: Take a single visible role UUID or system role identifier in this workspace. |
|
| sourceField | string | Y | Required string. Use a non-empty value and keep the case consistent with the actual attribute; dot-path traversal/wildcards are not supported. The API declares ≤256 characters, but the current storage column is 128; keep it ≤128 to avoid database errors. It is not automatically trimmed. Allowed null: False Maximum length: 256 Example: departmentHow to obtain or fill: Obtain the actual top-level userinfo attribute name from the deployment LDAP/OIDC identity source administrator; you can compare it with the account attributes after a successful login. |
| sourceValue | string | Y | Required string ≤256. Fill it exactly with the original value; it is not JSON array text or a regular expression. Empty strings are currently not uniformly rejected; whether they match depends on the actual userinfo. Allowed null: False Maximum length: 256 Example: engineeringHow to obtain or fill: Take the actual value of the attribute at login; for array attributes, use the string value of one of the elements. |
| targetValues | array | Y | Required array; a non-empty array is recommended. Unknown roles/roles from other workspaces are filtered out; statuses 0/2 are retained; if all roles do not exist or [] is used, NotFoundRole is returned. Status 2/deleted roles will not obtain valid permissions on subsequent logins; do not treat a saved true as indicating all roles take effect. The current workspace's custom entry does not apply the Owner prohibition of External system mappings; clients should choose target roles based on the actual authorization purpose.Example: ["general"]How to obtain or fill: From the target workspace's Role List, select a currently available role UUID/system role identifier, such as general/readOnly and custom role_. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/login_mapping/field/lgmp_example/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"sourceField":"department","sourceValue":"engineering","targetValues":["general"]}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | boolean | true on success; no new entity/UUID or role list is returned; check again with list. |
{
"code": 200,
"content": true,
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger | Message or Response Description | Resolution |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request fields are missing, or field values violate the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The Body top level is not a JSON object | Some JSON file format error | Submit a complete sourceField/sourceValue/targetValues object. |
| 404 | ft.SamlMappingFieldAlreadyExists | The current workspace's custom rule already has the same sourceField+sourceValue combination (modification excludes itself) | The workspace already has the same mapping field name and field value | Change the combination or modify the existing UUID; the historical error code is 404 and contains the Saml prefix, and is still used for this custom group. |
| 404 | ft.NotFoundRole | No visible role record in the target/existing mapping role set matches, including []; single delete or batch delete audit parsing of old roles may also trigger it |
Specified role not found or role deleted | First check against this workspace's role list and mapping list. If some unknown roles are mixed in, they are filtered out; historical empty/no-match sets cannot be directly assumed deletable; an administrator must repair them before handling. |
| 500 | ft.InternalServerError | An uncaught exception occurs in mapping/role/database storage or data formatting | Internal error | First use the list to check whether the rule has been saved and the final targetValues, then handle the specific field and retain traceId. |
| 404 | ft.LoginMappingNoExists | A single UUID does not belong to a mapping in this workspace with isSystem=false and status=0 | Specified Login Mapping not found | Re-obtain the lgmp_ UUID from the current workspace list; system rules or inactive records cannot be operated through this single-item entry. |