# Dynamic tenant pattern in role

**URL:** <https://forum.search-guard.com/t/dynamic-tenant-pattern-in-role/1900>\
**Category:** Search Guard\
**Created:** [July 16, 2020, 10:16am UTC](https://forum.search-guard.com/t/dynamic-tenant-pattern-in-role/1900 "2020-07-16T10:16:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NIckgregz](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@NIckgregz](https://forum.search-guard.com/u/NIckgregz)\
**Post date:** [July 16, 2020, 10:16am UTC](https://forum.search-guard.com/t/dynamic-tenant-pattern-in-role/1900/1 "2020-07-16T10:16:21Z")

</div>

Hello!  
Is there support for dynamic tenant patterns like there is for the index patterns when creating a role.  
Using `.kibana_*_tenant${openidAttribute}*` works inside of index patterns but `tenant-${openidAttribute}` doesn’t work for tenant patterns?  
And if a user role is connected to the tenant why doesn’t it have access to its’ specific .kibana tenant index unless it’s added manually(by adding `.kibana_*_tenant${openidAttribute}*` to the index pattern permissions)?  
To enable this the user role is connected to the main kibana role but then he has access to all of the kibana indices and not only his own?  
Thank you!

---

<div class="post-metadata">

**Author:** ![jkressin](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/jkressin/32/9_2.png) [@jkressin](https://forum.search-guard.com/u/jkressin)\
**Post date:** [July 16, 2020, 12:33pm UTC](https://forum.search-guard.com/t/dynamic-tenant-pattern-in-role/1900/2 "2020-07-16T12:33:14Z")

</div>

Not at the moment, but the feature is already in the backlog and will be added in one of the next releases.

---

<div class="post-metadata">

**Author:** ![jkressin](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/jkressin/32/9_2.png) [@jkressin](https://forum.search-guard.com/u/jkressin)\
**Post date:** [July 16, 2020, 12:36pm UTC](https://forum.search-guard.com/t/dynamic-tenant-pattern-in-role/1900/3 "2020-07-16T12:36:37Z")

</div>

Regarding tenants: Access to the tenant indices is handled by the Search Guard plugin automatically. Usually there is no need to configure any explicit permission for the index, unless you want to access it directly, which is discouraged by Elasticsearch and Kibana. If you want to modify saved objects in the tenant index, you should use the Kibana saved objecs API:

> **[Saved objects APIs | Kibana Guide \[master\] | Elastic](https://www.elastic.co/guide/en/kibana/master/saved-objects-api.html)**
>
> Conceptual and step-by-step procedures for using runtime fields, scripted fields, and field formatters.

To refer to a specific tenant, you just need to add the tenant name as HTTP header to your curl call:

`-H "sgtenant: <tenantname>"`

---

<div class="post-metadata">

**Author:** ![jkressin](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/jkressin/32/9_2.png) [@jkressin](https://forum.search-guard.com/u/jkressin)\
**Post date:** [July 16, 2020, 12:37pm UTC](https://forum.search-guard.com/t/dynamic-tenant-pattern-in-role/1900/4 "2020-07-16T12:37:33Z")

</div>

> [@NIckgregz](#):
>
> To enable this the user role is connected to the main kibana role but then he has access to all of the kibana indices and not only his own?

This part I don’t understand, can you elaborate please what you mean by this?

---

<div class="post-metadata">

**Author:** ![NIckgregz](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@NIckgregz](https://forum.search-guard.com/u/NIckgregz)\
**Post date:** [July 16, 2020, 1:13pm UTC](https://forum.search-guard.com/t/dynamic-tenant-pattern-in-role/1900/5 "2020-07-16T13:13:39Z")

</div>

Thank you very much for the answers!  
For a user to have the permission to see it’s tenant kibana objects it needs to have the main kibana role assigned?

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/system/32/1870_2.png) [@system](https://forum.search-guard.com/u/system)\
**Post date:** [August 6, 2020, 1:13pm UTC](https://forum.search-guard.com/t/dynamic-tenant-pattern-in-role/1900/6 "2020-08-06T13:13:40Z")

</div>

Closed on August 6, 2020, 1:13pm UTC

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
