grant

abstract fun grant(read: Boolean = false, write: Boolean = false, manage: Boolean = false, delete: Boolean = false, ttl: Int = -1, authKeys: List<String> = emptyList(), channels: List<String> = emptyList(), channelGroups: List<String> = emptyList(), uuids: List<String> = emptyList()): Grant

Deprecated

This function is deprecated. Use the grantToken(ttl, meta, authorizedUUID, channels, channelGroups, uuids)

Replace with

grantToken(ttl, meta, authorizedUUID, channels, channelGroups, uuids)

This function establishes access permissions for PubNub Access Manager (PAM) by setting the read or write attribute to true. A grant with read or write set to false (or not included) will revoke any previous grants with read or write set to true.

Permissions can be applied to any one of three levels:

  • Application level privileges are based on subscribeKey applying to all associated channels.

  • Channel level privileges are based on a combination of subscribeKey and channel name.

  • User level privileges are based on the combination of subscribeKey, channel, and auth_key.

Parameters

read

Set to true to request the read permission. Defaults to false.

write

Set to true to request the write permission. Defaults to false.

manage

Set to true to request the read permission. Defaults to false.

delete

Set to true to request the delete permission. Defaults to false.

ttl

Time in minutes for which granted permissions are valid. Setting ttl to 0 will apply the grant indefinitely, which is also the default behavior.

authKeys

Specifies authKey to grant permissions to. It's possible to specify multiple auth keys. You can also grant access to a single authKey for multiple channels at the same time.

channels

Specifies the channels on which to grant permissions. If no channels/channelGroups are specified, then the grant applies to all channels/channelGroups that have been or will be created for that publish/subscribe key set.

Furthermore, any existing or future grants on specific channels are ignored,
until the all channels grant is revoked.

It's possible to grant permissions to multiple channels simultaneously.
Wildcard notation like a.* can be used to grant access on channels. You can grant one level deep.
- `a.*` - you can grant on this.
- `a.b.*` - grant won't work on this. If you grant on `a.b.*`,
  the grant will treat `a.b.*` as a single channel with name `a.b.*`.
channelGroups

Specifies the channel groups to grant permissions to. If no channels or channelGroups are specified, then the grant applies to all channels/channelGroups that have been or will be created for that publish/subscribe key set.

Furthermore, any existing or future grants on specific [channelGroups] are ignored,
until the all [channelGroups] grant is revoked.

It's possible to grant permissions to multiple [channelGroups] simultaneously.

abstract fun grant(read: Boolean = false, write: Boolean = false, manage: Boolean = false, delete: Boolean = false, get: Boolean = false, update: Boolean = false, join: Boolean = false, ttl: Int = -1, authKeys: List<String> = emptyList(), channels: List<String> = emptyList(), channelGroups: List<String> = emptyList(), uuids: List<String> = emptyList()): Grant

Deprecated

This function is deprecated. Use the grantToken(ttl, meta, authorizedUUID, channels, channelGroups, uuids)

Replace with

grantToken(ttl, meta, authorizedUUID, channels, channelGroups, uuids)

See grant