disallow
Source Code | DocumentationPrevents access to a service method completely or for specific transports. When called without arguments, the method is blocked for all callers. When called with transport names, only those transports are blocked.
ts
import { disallow } from 'feathers-utils/hooks';Example
ts
import { disallow } from 'feathers-utils/hooks'
app.service('users').hooks({
before: {
remove: [disallow('external')], // block external access
update: [disallow()], // block completely
}
})Type declaration
Show Type Declarations
ts
/**
* Prevents access to a service method completely or for specific transports.
* When called without arguments, the method is blocked for all callers.
* When called with transport names, only those transports are blocked.
*
* @example
* ```ts
*
*
* app.service('users').hooks({
* before: {
* remove: [disallow('external')], // block external access
* update: [disallow()], // block completely
* }
* })
* ```
*
* @see https://utils.feathersjs.com/hooks/disallow.html
*/
export declare const disallow: <H extends HookContext = HookContext>(
transports?: MaybeArray<TransportName>,
) => (context: H, next?: NextFunction) => any| Argument | Type | Description |
|---|---|---|
| transports | MaybeArray<TransportName> |
| type | methods | multi |
|---|---|---|
| before, after, around | all | yes |
