-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding generateTenantToken method to the client #297
Conversation
720ae7e
to
81bee3f
Compare
81bee3f
to
1c4ccbc
Compare
55c0e20
to
de9ef9e
Compare
* | ||
* The $options parameter is an array, and the following keys are accepted: | ||
* - apiKey: The API key parent of the token. If you leave it empty the client API Key will be used. | ||
* - expiresAt: A DateTime when the key will expire. Note that if an expiresAt value is included it should be in UTC time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about add some validation about this UTC requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helps somehow? https://www.php.net/manual/en/datetime.gettimezone.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure we want to force the user to use the UTC
? Rather than putting a note of information?
tests/Endpoints/TenantTokenTest.php
Outdated
$this->assertArrayHasKey('hits', $response->toArray()); | ||
$this->assertArrayHasKey('query', $response->toArray()); | ||
$this->expectException(ApiException::class); | ||
$response = $tokenClient->index('tenantTokenDuplicate')->search(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I didn't follow why this test is testing 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not mandatory at all I just test if my token had access to the right index depending on the token's searchRules
.
src/Endpoints/TenantToken.php
Outdated
if (null == $searchRules) { | ||
throw InvalidArgumentException::emptyArgument('search rules'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change it for:
if ((!is_array($searchRules) && !is_object($searchRules)) || null == $searchRules) {
throw InvalidArgumentException::emptyArgument('search rules');
}
For checking and the type and the fact that searchRules
exist
Co-authored-by: cvermand <33010418+bidoubiwa@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
bors merge |
297: Adding generateTenantToken method to the client r=alallema a=alallema ## Tenant tokens Introduction of the new method `generateTenantToken` in order to facilitate the generation of the tenant token. Related to: - this issue: meilisearch/meilisearch#1991 - this spec: meilisearch/specifications#89 Co-authored-by: alallema <amelie@meilisearch.com> Co-authored-by: Amélie <alallema@users.noreply.github.com>
Build failed: |
292: Changes related to the next Meilisearch release (v0.26.0) r=alallema a=meili-bot Related to this issue: meilisearch/integration-guides#181 This PR: - gathers the changes related to the next Meilisearch release (v0.26.0) so that this package is ready when the official release is out. - should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases). - might eventually contain test failures until the Meilisearch v0.26.0 is out.⚠️ This PR should NOT be merged until the next release of Meilisearch (v0.26.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._ Done: - #296 - #298 - #297 - #302 Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com> Co-authored-by: Amélie <alallema@users.noreply.github.com> Co-authored-by: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Co-authored-by: alallema <amelie@meilisearch.com>
Tenant tokens
Introduction of the new method
generateTenantToken
in order to facilitate the generation of the tenant token.Related to: