FBoardPermission
Command-backed permissions for one Board unit.
Access
Access through:
Setup
Register @univerjs-pro/boards or a preset that includes it. In plugin mode, import @univerjs-pro/boards/facade. Additional methods below require their listed plugin packages. See Facade setup.
@univerjs-pro/boards
FBoardPermission.canEdit
Returns whether the whole Board is currently editable.
canEdit(): booleanReturns
Whether Board editing is allowed.
Package: @univerjs-pro/boards · Type definitions
FBoardPermission.getPoint
Returns the current value of one Board unit permission.
getPoint(action: BoardUnitPermissionAction): booleanParameters
action— Required. Unit permission action to query.
Returns
Whether the action is currently allowed.
Examples
import { UnitAction } from '@univerjs/protocol'const board = univerAPI.getActiveBoard()console.log(board?.getPermission().getPoint(UnitAction.Print))Types: BoardUnitPermissionAction
Package: @univerjs-pro/boards · Type definitions
FBoardPermission.setEditable
Enables or disables editing for the whole Board.
setEditable(editable?: boolean): Promise<void>Parameters
editable— Optional. Default:true. Whether editing is allowed. Defaults to true.
Returns
Resolves after the permission command finishes.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active Board.')await board.getPermission().setEditable()Types: Promise
Package: @univerjs-pro/boards · Type definitions
FBoardPermission.setObjectPermissions
Creates or updates child-object edit policies in this unit; policy: null removes protection and restores inheritance.
Requires Authz support and objectPermissionTypes configured for every target type. File and parent restrictions still apply. Use the exported permission object ID helpers, not raw object IDs or server permission IDs. The batch must be nonempty, contain distinct objects, and belong to this unit; file-wide policies are excluded.
edit: 'all' allows Unit editors, 'owner' restricts editing to the object owner, and 'members' selects existing Unit collaborators. Pass their collaborator records from the member service; this does not invite new users. Use strategies: [] for the default Edit strategy; child-object strategies support only UnitAction.Edit.
Authz writes execute per object and can partially succeed. Inspect failed before retrying only those objects. refreshError means writes finished but permission readback failed; do not retry succeeded objects for that error. Successful binding changes share one undo entry; existing remote policy edits are not undoable.
setObjectPermissions(changes: IObjectPermissionChange[]): Promise<IObjectPermissionBatchResult>Parameters
changes— Required. Permission object IDs and policies to apply.
Returns
Successful object IDs, per-object failures, and optional readback error.
Throws
Invalid batches or unsupported object types are rejected before Authz writes.
Examples
Set owner/member editing and remove protection in one batch
import type { ICollaborator } from '@univerjs/protocol'import { getBoardElementPermissionObjectId } from '@univerjs-pro/boards'// selectedMembers comes from the existing Unit collaborator picker/service.async function applyPermissions(selectedMembers: ICollaborator[]) { if (!selectedMembers.length) throw new Error('Select at least one Unit collaborator.') const board = univerAPI.getActiveBoard() if (!board) throw new Error('No active board.') const snapshot = board.getData() const pageId = snapshot.activePageId ?? snapshot.pageOrder[0] if (!pageId) throw new Error('No Board page.') const objectIds = Object.keys(board.getElements()) .slice(0, 3) .map((elementId) => getBoardElementPermissionObjectId(pageId, elementId)) if (objectIds.length < 3) throw new Error('This example requires three elements.') const result = await board.getPermission().setObjectPermissions([ { objectId: objectIds[0], policy: { edit: 'owner', collaborators: [], strategies: [] } }, { objectId: objectIds[1], policy: { edit: 'members', collaborators: selectedMembers, strategies: [] }, }, { objectId: objectIds[2], policy: null }, ]) // A policy creates protection if absent, or updates the existing policy when already configured. for (const failure of result.failed) { console.error(failure.objectId, failure.error) } if (result.refreshError) { console.error(result.refreshError) } return result}Types: IObjectPermissionBatchResult · Promise · IObjectPermissionChange
Package: @univerjs-pro/boards · Type definitions
FBoardPermission.setPoint
Sets one Board unit permission through the command system.
Supported actions are Edit, Copy, Print, Export, and Comment.
setPoint(action: BoardUnitPermissionAction, value: boolean): Promise<void>Parameters
action— Required. Unit permission action to update.value— Required. Whether the action is allowed.
Returns
Resolves after the permission command finishes.
Examples
import { UnitAction } from '@univerjs/protocol'const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active Board.')await board.getPermission().setPoint(UnitAction.Copy, false)Types: Promise · BoardUnitPermissionAction
Package: @univerjs-pro/boards · Type definitions
FBoardPermission.setReadOnly
Makes the whole Board read-only.
setReadOnly(): Promise<void>Returns
Resolves after the permission command finishes.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active Board.')await board.getPermission().setReadOnly()Types: Promise
Package: @univerjs-pro/boards · Type definitions
How is this guide?