Constructor
new ShareDialog(entityId, server, typeopt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
entityId | string | Project ID or folder path. | ||
server | object | Server instance (for token + baseUrl + backendUser). | ||
type | 'project' | | <optional> | 'project' |
Classes
Members
_perms
Resolved permissions: {owners, editors, viewers, any_with_link, public}
Methods
(async) _addUser(user, role, notify)
Grants the user access at the given role and refreshes the UI.
Parameters:
| Name | Type | Description |
|---|---|---|
user | object | User object from search results. |
role | string | Role to grant: 'editor' or 'viewer'. |
notify | boolean | Whether to email the user about the new access. |
(async) _authHeaders(extraopt) → {Promise.<object>}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
extra | object | <optional> | additional headers to merge in |
Returns:
- Type:
- Promise.<object>
_buildActionsSection() → {HTMLElement}
Returns:
the actions footer section with the open-presentation button
- Type:
- HTMLElement
_buildAddSection() → {HTMLElement}
Returns:
the "add people" search row section
- Type:
- HTMLElement
_buildDOM()
Builds and appends the dialog scrim and root DOM elements.
_buildLinkSection() → {HTMLElement}
Returns:
the "anyone with link" toggle section
- Type:
- HTMLElement
_buildPeopleSection() → {HTMLElement}
Returns:
the people list section
- Type:
- HTMLElement
_buildUserRow(user, role) → {HTMLElement}
Builds a single user row with avatar, name, and role controls.
Parameters:
| Name | Type | Description |
|---|---|---|
user | object | User object with id, display_name, and email. |
role | string | Current role: 'owner', 'editor', or 'viewer'. |
Returns:
- Type:
- HTMLElement
(async) _changeRole(user, oldRole, newRole)
Changes a user's role and persists the update.
Parameters:
| Name | Type | Description |
|---|---|---|
user | object | User object being updated. |
oldRole | string | Current role before the change. |
newRole | string | New role to assign. |
_clonePerms() → {object}
Convert internal {owners: [userObj]} shape to {owners: [id]} for the API.
Returns:
permissions payload with ID arrays
- Type:
- object
_confirmTransfer(newOwner)
Shows a confirmation modal before transferring ownership.
Parameters:
| Name | Type | Description |
|---|---|---|
newOwner | object | the user to transfer ownership to |
(async) _doTransfer(newOwner)
Executes the ownership transfer and reloads permissions.
Parameters:
| Name | Type | Description |
|---|---|---|
newOwner | object | the user to become the new owner |
_esc(str) → {string}
Parameters:
| Name | Type | Description |
|---|---|---|
str | string | Raw string to escape. |
Returns:
HTML-escaped string
- Type:
- string
_hashColor(id) → {string}
Parameters:
| Name | Type | Description |
|---|---|---|
id | string | User ID to hash into a color. |
Returns:
deterministic HSL color
- Type:
- string
_initials(name) → {string}
Parameters:
| Name | Type | Description |
|---|---|---|
name | string | Display name or email to derive initials from. |
Returns:
1-2 letter initials
- Type:
- string
(async) _load()
Fetches current permissions from the server and triggers a re-render.
_permPath() → {string}
Returns:
API permissions URL for the current entity.
- Type:
- string
(async) _putPerms(permissions, notifyopt) → {Promise.<boolean>}
Sends updated permissions to the server.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
permissions | object | Permissions payload with owner/editor/viewer ID arrays and link flags. | ||
notify | boolean | <optional> | true | Whether to notify affected users by email. |
Returns:
- Type:
- Promise.<boolean>
(async) _removeUser(user, role)
Removes a user's access and persists the update.
Parameters:
| Name | Type | Description |
|---|---|---|
user | object | User object to remove. |
role | string | Current role of the user being removed. |
_render()
Rebuilds the dialog body from current permissions state.
(async) _runSearch(query, dropdown, input, roleSelect, notifyWrap)
Searches for users matching the query and populates the dropdown.
Parameters:
| Name | Type | Description |
|---|---|---|
query | string | Search string typed by the user. |
dropdown | HTMLElement | Container element for search results. |
input | HTMLElement | Text input to clear after selection. |
roleSelect | HTMLElement | Role selector whose value is applied on selection. |
notifyWrap | HTMLElement | Wrapper containing the notify checkbox. |
_showStatus(msg, isErroropt)
Displays a transient status message at the bottom of the dialog.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
msg | string | Message text to display. | ||
isError | boolean | <optional> | false | If true, renders in error color. |
close()
Removes the dialog and scrim from the DOM.
getSharedUsers() → {Array}
Returns:
all users with any level of access
- Type:
- Array