Role configuration needed for giving read only access to dashboard

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?

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

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

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

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

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.

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