Add a user to role-mapping

Is there any api to update role mapping user such that it appends to the array of users. till now i can only find a api that would patch the whole array.

PATCH _opendistro/_security/api/rolesmapping/<role>
[
  {
    "op": "replace", "path": "/users", "value": ["userA", "userB", "userC"]
  }
]```

so at some point later i need to add userD. i need to get the existing list and add userD. 
i was expecting a idempotent way to add a user to rolemapping such that i do not have to care about the existing list that has the role mapping.
1 Like

Hi,

I am also trying to add mappings, I’ve tried:

PATCH _opendistro/_security/api/rolesmapping/<role>
[
  {
    "op": "add", "path": "/users", "value": ["userD"]
  }
] 

Unfortunately it doesn’t add userD, but replaces the whole mappings with userD