-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KZL-1005 - Add method to use request context in SDK queries (#1245)
Adds a method to use the original request user inside the requests sent by the embedded SDK. The main purpose of this feature is to properly set Kuzzle metadata (author and updater) on documents. Call to sdk.as(user) method will instantiate a new SDK with a FunnelProcotol that takes the user in the constructor and inject it in the request context before passing the request to theFunnel. // This will create a document with `author` metadata to `null` this.context.accessors.sdk.document.create(...); // This will create a document with `author` metadata to the original request user this.context.accessors.sdk.as(request.context.user).document.create(...); // This will throw a PluginImplementationError, no user impersonation for now this.context.accessors.sdk.as({ user: { _id: 'gordon' } }).document.create(...); Documentation: kuzzleio/documentation#253
- Loading branch information
1 parent
6fdc39f
commit b65bb21
Showing
5 changed files
with
3,230 additions
and
3,104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.