Skip to main content

loadModelForAction

@webda/core


Function: loadModelForAction()

loadModelForAction<T>(model, key, context, action): Promise<T>

Defined in: packages/core/src/models/permissions.ts:194

Load an object for an action as the caller: a missing object and an object the caller may not read throw the same NotFound("Object not found"); a readable object whose action is refused throws Forbidden

Type Parameters​

T​

T = any

Parameters​

model​

any

the model class

key​

any

the primary key

context​

IOperationContext

the caller context

action​

string

the action ("get" to only read)

Returns​

Promise<T>

the object