-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Following this product discussion: meilisearch/product#491 (comment)
Related to this spec: meilisearch/specifications#189
Goal
Allow using the wildcard *
at the end of the index name (in searchRules
field) when creating tenant tokens.
How does it work?
To create a tenant token, you need to provide a searchRules
field containing one or several index names.
{
"searchRules": {
"medical_records": {
"filter": "user_id = 1"
},
"medical_records_staging": {
"filter": "user_id = 1"
},
}
}
Also, the *
is already allowing as following, meaning "all the indexes":
{
"searchRules": {
"*": {
"filter": "user_id = 1"
}
}
}
But the users need an intermediate usage of the *
character: allowing to use the *
character at the end of the index name.
Instead of passing:
{
"searchRules": {
"medical_records": {
"filter": "user_id = 1"
},
"medical_records_staging": {
"filter": "user_id = 1"
},
}
}
The users could pass:
{
"searchRules": {
"medical_records*": {
"filter": "user_id = 1"
}
}
And this tenant will be available for all indexes matching medical_records*
, so medical_records
and medical_records_staging
will match, but not medical_record
(without s
)
Errors
- if no indexes are matched, no error are thrown during the tenant token creation. However this token will be useless until a matching index is created
Todo
- Implementation the changes by opening a PR in this repository -> open to external contributions. You can be inspired by this PR
- Update the spec regarding this -> API Keys - Introduce
*
wildcard char at the last position to express access to multiple indexes starting with the same string specifications#189
Impacted teams
Pinging @meilisearch/docs-team, but also @meilisearch/integration-team (I'm not sure for you)