Permissions
Bazaar permissions allow you to share content such as a shopping list and create social functionality like chatting with another user.
Create a Permission
Create, or grant, a new permission, i.e. share a resource.
The permission type can be PermissionType.READ
, PermissionType.INSERT
, PermissionType.UPDATE
, and PermissionType.DELETE
.
Setting userId to *
will grant this permission to any user. This allows you to create documents that are accessible to anybody or have the document itself dictate who has permission. For example, the permission
will give any user access to a document, given the user ID is present in the audience array.
Notify target user
When a personal permission, i.e., a permission with a set userId
is created, the target user may be notified something was shared with them. This is done via a sharing notification argument in the create
function:
The notification has the following type:
The createNotification
flag specifies if a notification on the target user’s Bazaar dashboard will be created.
The sendMessage
field defines under what circumstances an email will be sent to the target user. The options are SendNotification.NEVER
, SendNotification.ALWAYS
, and SendNotification.INVITE_ONLY
which only sends an email if the target user does not use the app the permission is for (it is an indirect invitation or nudge to use the app).
List Permissions
List all permissions created by a user:
Delete a Permission
Delete a permission a user has created:
Sharing Links
A sharing link allows a user to share a URL to give a specified permission. For example, you can create a link that gives the user that clicks on the link access to your private blog.
A sharing link object looks as follows:
Create a Link
Create a link to share a resource:
Creating link options
When creating a link you can also specify a description and a limit:
The description is a max 30 character long string to help users remember the purpose of the created link. The limit specifies how many times the link may be redeemed. The default is 1
. Setting it to 0
allows the link to be redeemed unlimited times.
List Links
List all of a user’s links:
Subscribe to Share Link Events
To react to redeemed links, you can subscribe to link change events
See more details about the listener
object.
Delete a Link
Delete a sharing link:
Permissions Granted to a User
When a personal permission is created, a granted permission object is created for the target user:
List Granted Permissions
List permissions that have been granted to the authenticated user in the current app:
Subscribe to Granted Permission Events
Subscribe to change event for permissions granted to a user:
See more details about the listener
object.
Delete a Granted Permission
Delete a permission that was granted to the authenticated user: