default( )


Sets the default permissions handler.

The default handler runs for all channels and resources where no explicit handler has been added with add(). Resources without their own handler inherit the parent channel's handler before falling back to the default.

For example, given the following setup:

  • channel: A, permissions: no handler
  • channel: A, resource: 1, permissions: no handler
  • channel: A, resource: 2, permissions: handler set with add()

Permissions are checked as follows:

  • A: default handler
  • A, resource 1: default handler
  • A, resource 2: handler set with add()

If no default handler is set, the built-in default permissions are used: {"read": true}.

Method Declaration
Copy
Method Parameters
handlerfunctionRequired

handler(channel: Channel, subscriber: Subscriber): Promise<{read: boolean}> | {read: boolean} Function to run when checking default permissions.

Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?