Class

ActionDecorator

ActionDecorator(params)

Decorates an action

Constructor

# new ActionDecorator(params)

Parameters:
Name Type Description
params Object
action Action
resource BaseResource
admin AdminJS

current instance of AdminJS

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 14

Classes

ActionDecorator

Methods

# canInvokeAction(context) → {boolean}

Indicates if user can invoke given action
Parameters:
Name Type Description
context ActionContext

passed action context

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 398

when user cannot perform given action

true given user has rights to the action

boolean

# async handler(request, response, context) → {Promise.<any>}

Original handler wrapped with the hook `before` and `after` methods.
Parameters:
Name Type Description
request ActionRequest
response any
context ActionContext

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 314

Promise.<any>

# async invokeAfterHook(response, request, context) → {Promise.<ActionResponse>}

Invokes after action hooks if there are any
Parameters:
Name Type Description
response ActionResponse
request ActionRequest
context ActionContext

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 349

Promise.<ActionResponse>

# async invokeBeforeHook(request, context) → {Promise.<ActionRequest>}

Invokes before action hooks if there are any
Parameters:
Name Type Description
request ActionRequest
context ActionContext

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 325

Promise.<ActionRequest>

# async invokeHandler(request, response, context) → {Promise.<ActionResponse>}

Invokes action handler if there is any
Parameters:
Name Type Description
request ActionRequest
response any
context ActionContext

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 337

Promise.<ActionResponse>

# isAccessible(currentAdminopt, recordopt) → {Boolean}

Is action accessible
Parameters:
Name Type Attributes Description
currentAdmin CurrentAdmin <optional>

currently logged in admin user

record BaseRecord <optional>

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 388

Boolean

# isBulkType() → {Boolean}

Returns true when action can be performed on selected records

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 370

Boolean

# isRecordType() → {Boolean}

Returns true when action can be performed on a record

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 356

Boolean

# isResourceType() → {Boolean}

Returns true when action can be performed on an entire resource

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 363

Boolean

# isVisible(currentAdminopt, recordopt) → {Boolean}

Is action visible in the UI
Parameters:
Name Type Attributes Description
currentAdmin CurrentAdmin <optional>

currently logged in admin user

record BaseRecord <optional>

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 379

Boolean

# toJSON(currentAdminopt) → {ActionJSON}

Serializes action to JSON format
Parameters:
Name Type Attributes Description
currentAdmin CurrentAdmin <optional>

View Source adminjs/src/backend/decorators/action/action-decorator.ts, line 407

serialized action

ActionJSON