add( )


Sets a permissions handler for a specific channel or channel resource.

Adding a handler to a channel without specifying a resource applies the handler to the channel itself and to any of its resources that don't have their own handler.

For example, given the following setup:

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

Permissions are checked as follows:

  • A: handler X
  • A, resource 1: handler Y
  • A, resource 2: handler X (inherited from channel)
Method Declaration
Copy
Method Parameters
channelChannelRequired

Channel or channel resource to set a permissions handler for.


handlerfunctionRequired

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

Errors

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

Did this help?