aWhere Manual
DevelopWidgets

Item sharing

Opens the permission settings of one Item in your page. The widget saves the permissions itself and tells your page with the message applied or cancel.

The item-sharing widget sets who can open an Item, and gives people or groups a role on it. The widget saves the permissions through the platform itself. Your page does not call the API.

URL and parameters

The widget is at <site>/widgets/item-sharing. The parameters every widget takes are in Widgets.

ParameterMeaningRequired
item_idThe _id of the Item to set permissions on.Yes

Messages

actionDirectionpayload
appliedwidget to your pageNone. Sent after the permissions are saved.
cancelwidget to your pageNone. The user closed it without saving.

This widget does not send ready and does not read post-widget-parameters. It sends error and close-with-error as in Widgets.

If saving fails, the widget shows its own error and does not send applied.

Example

embedParams is the common parameters from Widgets.

const params = new URLSearchParams({ ...embedParams, item_id: itemId })
frame.src = `${site}/widgets/item-sharing?${params}`

addEventListener('message', (e) => {
  if (e.origin !== site || e.data.messageToken !== messageToken) return
  if (e.data.action === 'applied' || e.data.action === 'cancel') frame.remove()
})

On this page