Skip to content

Commit

Permalink
fix(crud): property scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Aschen committed Jan 23, 2022
1 parent 8375f63 commit e5a7f0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions lib/crud/CRUDController.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { KuzzleRequest, PluginContext, JSONObject, ControllerDefinition, Plugin } from 'kuzzle';
import { KuzzleRequest, PluginContext, JSONObject, ControllerDefinition, Plugin, EmbeddedSDK } from 'kuzzle';
export declare class CRUDController {
protected context: PluginContext;
protected config: JSONObject;
private collection;
protected collection: string;
definition: ControllerDefinition;
constructor(plugin: Plugin, collection: string);
get as(): (user: any) => import("kuzzle").EmbeddedSDK;
protected get as(): (user: {
_id: string;
}) => EmbeddedSDK;
/**
* Create an asset or a device depending on the collection.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/crud/CRUDController.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/crud/CRUDController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import {
JSONObject,
ControllerDefinition,
Plugin,
EmbeddedSDK,
} from 'kuzzle';

export class CRUDController {
protected context: PluginContext;
protected config: JSONObject;
private collection: string;
protected collection: string;

public definition: ControllerDefinition;

constructor (plugin: Plugin, collection: string) {
Expand All @@ -18,7 +20,7 @@ export class CRUDController {
this.collection = collection;
}

get as () {
protected get as (): (user: { _id: string }) => EmbeddedSDK {
return user => this.context.accessors.sdk.as(user, { checkRights: true });
}

Expand Down

0 comments on commit e5a7f0e

Please sign in to comment.