# Create user with opendistro\_security\_roles - not creating any rolemapping

**URL:** <https://forum.opensearch.org/t/create-user-with-opendistro-security-roles-not-creating-any-rolemapping/5559>\
**Category:** Security\
**Created:** [April 11, 2021, 3:09pm UTC](https://forum.opensearch.org/t/create-user-with-opendistro-security-roles-not-creating-any-rolemapping/5559 "2021-04-11T15:09:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![orid](https://avatars.discourse-cdn.com/v4/letter/o/6f9a4e/32.png) [@orid](https://forum.opensearch.org/u/orid)\
**Post date:** [April 11, 2021, 3:09pm UTC](https://forum.opensearch.org/t/create-user-with-opendistro-security-roles-not-creating-any-rolemapping/5559/1 "2021-04-11T15:09:54Z")

</div>

Hi,  
I am using OpenDistro 1.11.0.  
When creating a user using REST api, it works when mapping the user to an existing role ‘exporter\_role’ I’ve created previously:

```auto
PUT https://{{esHost}}:{{esPort}}/_opendistro/_security/api/internalusers/exporter_test
{
  "password": " ******",
  "opendistro_security_roles" : ["exporter_role"]
}

```

I tested, and user indeed has access by the permissions of the ‘exporter\_role’.

1. Why this API doesn’t create any rolemapping entity? Also, in Kibana, this mapping is not shown because the lack of rolemapping.  
Is this a bug?

2. I can also add the rolemapping by API, and then it is shown in Kibana. But I am not sure if it is really needed or not.

```auto
PUT https://{{esHost}}:{{esPort}}/_opendistro/_security/api/rolesmapping/exporter_role
{
  "users" : ["exporter_test"]
}

```

Thank you,  
Ori.

---

<div class="post-metadata">

**Author:** ![Anthony](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/anthony/32/9939_2.png) [@Anthony](https://forum.opensearch.org/u/Anthony)\
**Post date:** [April 12, 2021, 6:37pm UTC](https://forum.opensearch.org/t/create-user-with-opendistro-security-roles-not-creating-any-rolemapping/5559/3 "2021-04-12T18:37:29Z")

</div>

Hi @orid  
If you are creating user via API, the security\_role is passed in attributes, therefore there is no exclusive mapping showing up in the UI.  
If you want the mapping to show up in UI you will need to create it manually via API or configuration files. But there is no added benefit except the UI element.

---

<div class="post-metadata">

**Author:** ![orid](https://avatars.discourse-cdn.com/v4/letter/o/6f9a4e/32.png) [@orid](https://forum.opensearch.org/u/orid)\
**Post date:** [April 13, 2021, 7:18am UTC](https://forum.opensearch.org/t/create-user-with-opendistro-security-roles-not-creating-any-rolemapping/5559/4 "2021-04-13T07:18:48Z")

</div>

Thanks for the clarification, @Anthony / @pablo .
