Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
API Keys - Introduce * wildcard char at the last position to expres…
Browse files Browse the repository at this point in the history
…s access to multiple indexes starting with the same string (#189)

* Bump open-api spec

* Precise that the * wildcard char can be used at the last position to match multiple indexes starting with the same string

* Update future possibilities

* Update the index wildcard pattern error message

---------

Co-authored-by: Clément Renault <clement@meilisearch.com>
  • Loading branch information
gmourier and Kerollmops authored Apr 3, 2023
1 parent 6d9a5fd commit 48895d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ components:
readOnly: true
actions:
type: array
description: 'A list of actions permitted for the key. ["*"] for all actions.'
description: 'A list of actions permitted for the key. ["*"] for all actions. The * character can be used as a wildcard when located at the last position. e.g. `documents.*` to authorize access on all documents endpoints.'
uniqueItems: false
items:
type: string
Expand Down Expand Up @@ -707,7 +707,7 @@ components:
- keys.delete
indexes:
type: array
description: 'A list of accesible indexes permitted for the key. ["*"] for all indexes.'
description: 'A list of accesible indexes permitted for the key. ["*"] for all indexes. The * character can be used as a wildcard when located at the last position. e.g. "products_*"" to allow access to all indexes whose names start with "products_".'
items:
type: string
example: movies
Expand Down
2 changes: 1 addition & 1 deletion text/0061-error-format-and-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ HTTP Code: `400 Bad Request`

```json
{
"message": "`uid` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_).",
"message": "`uid` is not a valid index uid pattern. Index uid patterns can be an integer or a string containing only alphanumeric characters, hyphens (-), underscores (_), and optionally end with a star (*).",
...
}
```
Expand Down
5 changes: 3 additions & 2 deletions text/0085-api-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ Create an API key.
| uid | string | Optional | A unique identifier represented by a [uuid v4](https://fr.wikipedia.org/wiki/Universally_unique_identifier). Specified at creation or generated by Meilisearch if ommited. |
| name | string | Optional | A non unique human readable name to ease identification of the API key. **Default**: `null` |
| description | string | Optional | A description for the API key. **Default**: `null` |
| actions | array | Required | A list of actions permitted for the API key. `["*"]` for all actions. **See Actions list definition part**. `*` character can be used as a wildcard. e.g. `documents.*` to authorize access on all documents endpoints. **Default**: `No default` |
| indexes | array | Required | `[*]` for all indexes. **Default**: `No Default` |
| actions | array | Required | A list of actions permitted for the API key. `["*"]` for all actions. **See Actions list definition part**. The `*` character can be used as a wildcard when located at the last position. e.g. `documents.*` to authorize access on all documents endpoints. **Default**: `No default` |
| indexes | array | Required | `[*]` for all indexes. The `*` character can be used as a wildcard when located in the last position. e.g. `products_*` to allow access to all indexes whose names start with `products_`. **Default**: `No Default` |
| expiresAt | string | Required | The expiration date and time as `RFC 3339` format. `null` equals to no expiration time. Sending only the date part e.g `2021-12-01` leads to having an `expiresAt` value set to `2021-12-01T00:00:00`. **Default**: `No Default` |

###### 3.2.4.4.2. `actions` List Definition
Expand Down Expand Up @@ -479,3 +479,4 @@ The maximum size of the API key storage layer is `100GB`.
- Add search parameters restrictions for an API Key.
- Add rfc2822 format expression for `expiredAt` field. e.g. `Wed, 18 Feb 2022 23:16:09 GMT`
- Add an alias that can only be associated to one API Key to retrieve it easily on client side. e.g. `GET /keys/:uid_or_alias`
- Supports wildcard expressions at the start/middle of a string.

0 comments on commit 48895d1

Please sign in to comment.