Operations to permissions mapping

The tables below list each PubNub API operation, the resource it targets, and the permission flag it requires when Access Manager is enabled on a keyset.

Chat SDK

For Chat SDK method to Access Manager permission mappings, see Security and permissions.

Pub/Sub​

Pub/Sub sends and receives messages on channels. These operations need permissions on the channel or channel group they target.

OperationResourcePermission
Publish on channelChannelwrite
Signal on channelChannelwrite
Subscribe to channelChannelread
Subscribe to presence channelPresence channel (-pnpres)read
Subscribe to channel groupChannel groupread on the group only
Subscribe to presence channel groupPresence channel group (-pnpres)read
Unsubscribe from channelChannelNone required
Unsubscribe from channel groupChannel groupNone required

Presence​

Presence tracks which users are connected to a channel and their state. These operations need permissions on the channel.

OperationResourcePermission
Here NowChannelread
Where NowChannelNone required
Get StateChannelread
Set StateChannelread

Message Persistence​

Message Persistence stores published messages so clients can fetch them later. These operations need permissions on the channel that holds the messages.

OperationResourcePermission
Fetch messagesChannelread
Message countsChannelread
Delete messagesChanneldelete

File sharing​

Files lets clients send and download files on a channel. These operations need permissions on that channel.

OperationResourcePermission
Send file on channelChannelwrite
List filesChannelread
Download fileChannelread
Delete fileChanneldelete

Channel groups​

A channel group lets a client subscribe to many channels as one unit. These operations need permissions on the channel group.

Grant channel group manage permission only to server-side code

Access Manager treats manage on a channel group as an administrative permission. Grant it only in tokens used by server-side code and administrators.

A client token with manage and read on a channel group can add any channel name on the keyset to the group and read that channel's messages through the group.

When a client subscribes to a channel group, or includes a channel group in a presence call such as Here Now, Access Manager checks read on the channel group and does not check read on the channels in the group. See Channel groups and channel permissions.

OperationResourcePermission
Add channels to channel groupChannel groupmanage
Remove channels from channel groupChannel groupmanage
List channels in channel groupChannel groupread
Remove channel groupChannel groupmanage

App Context​

App Context stores user metadata, channel metadata, and memberships. These operations need permissions on the UUID, the channel, or both.

OperationResourcePermission
Set user metadataUUIDupdate
Delete user metadataUUIDdelete
Get user metadataUUIDget
Get all user metadataUUIDManaged by the Disallow Get All User Metadata option in App Context configuration on the Admin Portal. When this option is unchecked and Access Manager is enabled, you can get metadata of all users without a permission grant.
Set channel metadataChannelupdate
Delete channel metadataChanneldelete
Get channel metadataChannelget
Get all channel metadataChannelManaged by the Disallow Get All Channel Metadata option in App Context configuration on the Admin Portal. When this option is unchecked and Access Manager is enabled, you can get metadata of all channels without a permission grant.
Set channel membersChannelmanage
Remove channel membersChannelmanage
Get channel membersChannelget
Set channel membershipsChannel and UUIDChannel: join. UUID: update.
Remove channel membershipsChannel and UUIDChannel: join. UUID: update.
Get channel membershipsUUIDget

DataSync​

DataSync stores entities, relationships, users, channels, and memberships as typed objects. These operations need permissions on the resource type that matches the object kind:

Object kindResource type
Generic entitydatasync:entities
Relationshipdatasync:relationships
Membershipdatasync:memberships
User entityusers
Channel entitychannels
OperationResourcePermission
Get objectResource type of the object kindget
Create objectResource type of the object kindcreate
Replace objectResource type of the object kindupdate
Partial update (patch) objectResource type of the object kindupdate
Delete objectResource type of the object kinddelete
Subscribe to an object's ID channel or projection channelChannelread

DataSync user entities use the users resource type, not uuids. A token that grants only uuids permissions doesn't authorize DataSync operations on users. Refer to DataSync access control for credentials and field-level projection grants.

Mobile Push Notifications​

Mobile Push Notifications delivers channel messages to devices through Firebase Cloud Messaging (FCM) and Apple Push Notification service (APNs). Only registering a channel needs a channel permission.

OperationResourcePermission
Register channel for pushChannelread on each added channel
Remove channel push registrationNoneNone
List channels for a device (FCM and APNs2)NoneNone
List devices for a channelNoneServer only. Sign the request with the secret key.

Removing a registration and listing a device's channels still check the token if the request includes one. A token that is expired, revoked, or issued for a different User ID returns 403.

Message Actions​

Message Actions attach reactions, receipts, and other metadata to a published message. These operations need permissions on the channel that holds the message.

OperationResourcePermission
Add message actionChannelwrite
Remove message actionChanneldelete
Get message actionsChannelread
Get history with actionsChannelread

Was this page useful?

Last updated on