Sets a permissions handler for default permissions.
The handler set by the default()
function is used for permission checks by the permissions
router for all channels where an explicit handler has not been added. For channel resources,
if no explicit handler has been set, the resource will inherit the permissions of its parent
channel.
For example, suppose you have the following channel, resources, and permissions:
Permissions will be checked as follows:
default()
functiondefault()
functionadd()
function for this resourceIf no default handler is set, subscribers to channels without explicit permissions handlers will
receive the following permissions:
{"read": true}
handler(channel: Channel, subscriber: Subscriber): Promise<ChannelPermissions> | ChannelPermissions
The name of the
function or the function expression to use when checking default permissions.