# Role configuration needed for giving read only access to dashboard

**URL:** <https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765>\
**Category:** OpenSearch Dashboards\
**Created:** [December 10, 2024, 6:50am UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765 "2024-12-10T06:50:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sayalipatil9689](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@sayalipatil9689](https://forum.opensearch.org/u/sayalipatil9689)\
**Post date:** [December 10, 2024, 6:50am UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/1 "2024-12-10T06:50:55Z")

</div>

In my application, admin has created certain dashboards on one index.

Now I want to create two roles for users for visibility of those dashboards.

1. role with read only access to those dashboards where DQL can be applied from prompt on displayed dashboards
2. role with read only access to those dashboards where DQL cannot be present to apply and dashboard will be fully read only.

I need to create these two roles only using roles.yml and roles\_mapping.yml and cannot create from UI of openSearch Dashboard as due to some infra constraints Security option on UI is not available.

How to do that?

---

<div class="post-metadata">

**Author:** ![cwperks](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/cwperks/32/4968_2.png) [@cwperks](https://forum.opensearch.org/u/cwperks)\
**Post date:** [December 10, 2024, 4:04pm UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/2 "2024-12-10T16:04:33Z")

</div>

There’s a dashboards setting for readonly users. i.e. users that cannot make changes to saved objects (index patters, visualizations, dashboards)

```auto
opensearch_security.readonly_mode.roles: ["<role_for_read_only>"]

```

Documentation page: [https://opensearch.org/docs/latest/security/configuration/multi-auth/#sample-setup](https://opensearch.org/docs/latest/security/configuration/multi-auth/#sample-setup)

Not sure about DQL on a prompt on a displayed dashboard though.

---

<div class="post-metadata">

**Author:** ![sayalipatil9689](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@sayalipatil9689](https://forum.opensearch.org/u/sayalipatil9689)\
**Post date:** [December 11, 2024, 10:34am UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/3 "2024-12-11T10:34:24Z")

</div>

is there any way to handle it through roles.yml and roles\_mapping.yml? I tried with kibana\_read\_only role, but it still makes edit dashboard option enabled.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/b/bd47531e93fdc8a4f778e63172e56735d33a3d61.png)

In above image, basically I do not want to have edit button and DQL option enabled.

---

<div class="post-metadata">

**Author:** ![Apoorva](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Apoorva](https://forum.opensearch.org/u/Apoorva)\
**Post date:** [April 14, 2025, 2:29pm UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/4 "2025-04-14T14:29:06Z")

</div>

Facing same issue. Is there a way to remove Edit option in dashboards for read\_only users?

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [April 15, 2025, 11:23pm UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/5 "2025-04-15T23:23:23Z")

</div>

@Apoorva The described read\_only user is a placeholder role for `opensearch_security.readonly_mode.roles:` option located in opensearch\_dashboards.yml file. Any user with the role placed in that option will get limited view of the OpenSearch Dashboards.

If you’d like to disable Edit button, then you must set tenant access to `Read only` in the role settings.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/5/52da4299683fcaf34ef0ce54f31f50305f32620a.png)

Please be aware that setting Read only access to the tenant will prevent any create, update or delete actions to any OpenSearch Dashboards objects (i.e. visualisations, search, dashboards etc. )

---

<div class="post-metadata">

**Author:** ![Apoorva](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Apoorva](https://forum.opensearch.org/u/Apoorva)\
**Post date:** [April 16, 2025, 8:26am UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/6 "2025-04-16T08:26:55Z")

</div>

Even after setting global tenant to **Read only** for view opensearch dashboard only user, I can see Edit option enabled in the dashboard. Is it possible to disable or hide **edit and create** option for user with the role placed in `opensearch_security.readonly_mode.roles:` option ??

 ![Screenshot 2025-04-16 at 1.57.51 PM](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/9/9d559f0534968266f00a564c03588202c7db766e.png)

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [April 16, 2025, 9:51am UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/7 "2025-04-16T09:51:05Z")

</div>

@Apoorva Could you share the output of the following command?

```auto
curl --insecure -u <username>:<password> https://<OpenSearch_node_IP_or_FQDN>:9200/_plugins/_security/authinfo?pretty

```

Is the dashboard from the screenshot located in the Global Tenant?  
Do you use more than one tenant?

---

<div class="post-metadata">

**Author:** ![Apoorva](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Apoorva](https://forum.opensearch.org/u/Apoorva)\
**Post date:** [April 16, 2025, 10:21am UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/8 "2025-04-16T10:21:32Z")

</div>

Here is the ouput of the command provided

```auto
{
  "user" : "User [name=testviewer, backend_roles=[viewer], requestedTenant=null]",
  "user_name" : "testviewer",
  "user_requested_tenant" : null,
  "remote_address" : "[::1]:46870",
  "backend_roles" : [
    "viewer"
  ],
  "custom_attribute_names" : [
    "attr.internal.name"
  ],
  "roles" : [
    "own_index",
    "opensearch_dashboards_read_only",
    "read_only_index"
  ],
  "tenants" : {
    "testviewer" : true,
    "global_tenant" : false,
    "admin_tenant" : false
  },
  "principal" : null,
  "peer_certificates" : "0",
  "sso_logout_url" : null
}

```

My opensearch doesn’t have multitenancy configured.

---

<div class="post-metadata">

**Author:** ![Apoorva](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Apoorva](https://forum.opensearch.org/u/Apoorva)\
**Post date:** [April 17, 2025, 6:38am UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/9 "2025-04-17T06:38:29Z")

</div>

I’ve noticed that there is a security permission issue returned when user executes action create / edit dashboard.  
I’m referring to this [bug](https://github.com/opensearch-project/security/issues/3960) reported where it is mentioned that hiding options is not supported in opensearch, can you please let me know if this issue fix is added in latest version or is there any alternate solution that I can use in opensearch version 2.15??

Note: I have assigned a read-only role to a user which is placed in `opensearch_security.readonly_mode.roles:` option, which allows them to view dashboards module as expected.

OpenSearch version 2.15  
Multitenancy is not Configured.

---

<div class="post-metadata">

**Author:** ![Apoorva](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Apoorva](https://forum.opensearch.org/u/Apoorva)\
**Post date:** [April 17, 2025, 9:24am UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/10 "2025-04-17T09:24:35Z")

</div>

@pablo can you please help me with this?

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [April 18, 2025, 2:00pm UTC](https://forum.opensearch.org/t/role-configuration-needed-for-giving-read-only-access-to-dashboard/22765/11 "2025-04-18T14:00:00Z")

</div>

@Apoorva

> [@Apoorva](#):
>
> Multitenancy is not Configured.

I don’t this statement is correct as per your authinfo output

> [@Apoorva](#):
>
> ```auto
> "tenants" : {
> "testviewer" : true,
> "global_tenant" : false,
> "admin_tenant" : false
> 
> ```

In that case Read only permission should be applied to `testviewwer` tenant.
