# Permissions and authorization

> Unit-level actions, product-specific object permissions, and authorization across frontend and backend.

- Human documentation: [https://docs.univer.ai/overview/features/shared/permissions](https://docs.univer.ai/overview/features/shared/permissions)

- Agent Markdown: [https://docs.univer.ai/overview/features/shared/permissions.md](https://docs.univer.ai/overview/features/shared/permissions.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.6.1`

- Source: [features/shared/permissions.mdx](https://github.com/dream-num/documentation/blob/dev/content/docs/features/shared/permissions.mdx)

---

Univer separates permissions into two layers: **actions on a whole content Unit** and **permissions on objects inside it**. The Web SDK uses these permissions to control interactions and command execution. The Server SDK defines the authorization boundaries for reads, collaborative submissions, and extension services.

## Unit-level permissions

A [Unit](https://docs.univer.ai/guides/sheets/getting-started/quickstart.md#unit) is one complete content instance, such as a workbook, document, presentation, Relational Table, board, or PDF. The Unit permissions below apply to Sheets, Docs, Slides, Relational Table, and Canvases. PDF is described separately in its own section.

| Permission | Controls | Example |
| --- | --- | --- |
| Edit | Changing content and structure. | Viewers read; editors fill in and rearrange content. |
| Copy | Copying content inside the editor. | Allow reading and comments while preventing copying. |
| Comment | Starting comments and replies when comment features are installed. | Reviewers comment while the content remains read-only. |
| Print | Using the product's print feature. | Allow online reading while preventing printing. |
| Export | Exporting content to a supported file format. | Deliver the file to others, or archive it. |

Editing and commenting are independent of each other. Editing, deleting, and managing comments also follow your application's author and owner policies.

Print and Export are also Unit-level permissions. Sheets, Docs, Slides, and Canvases expose both; Relational Table currently exposes Export only. Each permission works with its corresponding feature plugins.

Copying content, duplicating a file, exporting, and downloading are four separate operations. Whether a file can be opened depends on your application's read authorization.

For example, configure a Doc's Unit-level permissions independently:

```ts
import { UnitAction } from '@univerjs/protocol'

const document = univerAPI.getActiveDocument()
if (!document) throw new Error('Open a document first')

const permission = document.getPermission()
await permission.setReadOnly()
await permission.setPoint(UnitAction.Copy, false)
await permission.setPoint(UnitAction.Comment, true)
await permission.setPoint(UnitAction.Print, false)
await permission.setPoint(UnitAction.Export, false)
```

Register the product and comment plugins first. Plugin mode also requires `@univerjs/docs/facade`. Product accessors are listed below. Sheets uses its own permission-point enums.

The Pro collaboration server checks `UnitAction.Comment` when a nonempty changeset contains only the built-in thread-comment mutations: add, delete, resolve, update, or reference-update. Mixed changesets, and any mutation that changes document content, including Docs comment decorations, still require `UnitAction.Edit`. The application must also enforce its own comment author and owner policies. If you use custom Collaboration SDK Service Middleware, classify changesets the same way in your `submitChangeset` policy. A blanket Edit check blocks reviewers who hold only comment permission from submitting comments.

## Product-specific content permissions

### Sheets

Permission levels are **workbook → worksheet → cell range**. The workbook level controls editing, copying, and commenting for the whole file. Worksheet permission points restrict values, styles, row and column changes, sorting, filtering, pivot tables, and additional objects. Range protection controls who can edit or view a selected area, and it can name the collaborators who are permitted.

For example, protect the budget formulas and leave the expense inputs editable. Use `getWorkbookPermission()`, `getWorksheetPermission()`, and `getRangePermission()`. Create the worksheet or range protection rule before setting its protection points. When read access is restricted, the application must also control the data it returns.

[Sheets permissions and protection](https://docs.univer.ai/guides/sheets/features/core/permission.md)

### Docs

Below the document level, **sections, paragraphs, and content entities** can be protected. Entities include tables, drawings, custom blocks, and ranges with stable identifiers. Header and footer paragraphs are addressed through their segment.

For example, protect the contract clauses and leave the paragraphs that need to be filled in editable. Sections and paragraphs expose `getPermission()`; for entities, use `document.getEntityPermission()`. The effective result combines the document, any applicable parent, and the object's own rules.

[Document permissions](https://docs.univer.ai/reference/facade/document-permission.md) · [Section, paragraph, and entity permissions](https://docs.univer.ai/reference/facade/document-object-permission.md)

### Slides

Protection can apply to **a presentation, individual slides, page elements, and the master-editing entry and master elements**. Branded templates and fixed graphics can stay locked while selected text boxes, images, or chart objects remain editable.

Use `presentation.getPermission()`, `slide.getPermission()`, and `slide.getElementPermission()`. Master-related accessors are provided by the Presentation Facade.

[Slides permissions](https://docs.univer.ai/guides/slides/features/core/permissions.md) · [Presentation Facade](https://docs.univer.ai/reference/facade/presentation.md)

### Relational Table

Permissions cover **tables, fields, records, views, and dashboards**. When someone edits a cell, the Relational Table, table, field, and record restrictions apply together. View configuration and dashboards can be protected separately.

For example, protect the schema and the financial records while people continue to maintain their everyday tasks. Tables, fields, records, and views expose `getPermission()`; dashboards require their plugin. Filtering readable fields and records per user is the responsibility of your application's data-read policy.

[Relational Table permissions](https://docs.univer.ai/guides/bases/features/core/permissions.md) · [Object permission API](https://docs.univer.ai/reference/facade/base-object-permission.md)

### Canvases

Within a Canvases Unit, **individual elements** can be protected: shapes, text, images, and connectors. An architecture background or a workflow framework can stay protected while collaborators edit only the nodes they maintain.

Use `board.getPermission()` for the Unit and `board.getElementPermission(elementId)` for individual elements. Editing an element requires permission at both the Canvases level and the element level.

[Canvases permissions](https://docs.univer.ai/reference/facade/board-permission.md) · [Element permissions](https://docs.univer.ai/reference/facade/board-element-permission.md)

### PDF

PDF currently uses **view/edit modes** for local interaction, a different scope from the Unit and object permission APIs that the other five products use. The backend authorizes file reads, downloads, and exports. PDF is also outside the five Unit types that Core Collaboration supports.

[PDF integration and content operations](https://docs.univer.ai/guides/pdfs/getting-started/facade.md)

## Inheritance and collaborator policies

**An object grant never overrides a Unit-level restriction or an applicable parent restriction.** Making a paragraph editable has no effect when the document is read-only. For supported objects, query `canEdit()` for the effective result.

In Docs, Slides, Relational Table, and Canvases, child-object permissions mainly control Edit; Copy and Comment are configured at the Unit level. Sheets adds worksheet and range permission points, so the granularity differs by product.

Docs, Slides, Relational Table, and Canvases provide `setObjectPermissions()` to set collaborator policies in batches:

| Policy | Who may edit the object |
| --- | --- |
| `all` | Collaborators who already hold Edit permission on the Unit. |
| `owner` | The owner of the object, provided the Unit and parent restrictions allow it. |
| `members` | Only the Unit collaborators you select. |

These policies require Authz integration, `objectPermissionTypes` configured for the target types, and persisted object bindings, rules, and memberships. Use the object-ID helpers that the SDK exports and keep content IDs stable. `policy: null` removes protection and restores inheritance. A batch write can succeed for some objects and fail for others, so check `failed` and `refreshError`. Sheets applies its policies through the worksheet and range protection APIs.

## Authorization across frontend and backend

Maintain a single trusted identity and Unit/object policy system that drives both frontend behavior and backend authorization.

```mermaid
flowchart LR
    P["Application identity<br/>and permission policies"]
    W["Web SDK<br/>Interaction and command checks"]
    S["Server SDK<br/>Request and change authorization"]
    D["Persist and broadcast"]
    P --> W
    P --> S
    W -->|"Submit edits"| S
    S -->|"Allowed"| D
```

| Layer | Responsibility |
| --- | --- |
| Web SDK | Reads the current user's allowed actions, updates permission points and editing controls, and checks commands. |
| Application Authz API | Queries or changes policies using the trusted identity, returns the effective Unit and object permissions, and authorizes policy management. |
| Transport | Authenticates Cookie, Session, or Token credentials and establishes the trusted identity. User fields sent by the client are not authorization evidence. |
| Endpoint | Authorizes WebSocket connections and `joinUnit` room membership. |
| Service | Checks reads at `readUnitData` and submissions at `submitChangeset`, and evaluates object policies against the affected content while the changeset is applied. |

The Server SDK supplies Middleware hooks; the application supplies the ACL and object policies. **Read-only settings and object protection on the frontend do not enforce backend authorization by themselves.** If the application checks only Unit-level Edit, object checks must be added to enforce paragraph, element, field, or record restrictions.

For example, connect an existing `collabService` to your own `acl`:

```ts
import { CollabError } from '@univerjs-pro/collaboration-service'

collabService.use('submitChangeset', async (context, next) => {
  const allowed = await acl.canEdit(
    context.userID,
    context.request.changeset.unitID,
  )
  if (!allowed) {
    throw new CollabError('PERMISSION_DENIED', 'Editing is not allowed')
  }
  await next()
})
```

This example covers Unit-level editing only. Reads, JOIN, policy changes, and extension endpoints need protection as well. For fine-grained writes, validate the affected objects in an application stage such as `applyChangeset`, and keep the policies safe to retry.

For the full integration, see [identity and authorization](https://docs.univer.ai/server/collaboration/identity-and-authorization.md). Lifecycle hooks are described in [Middleware and Events](https://docs.univer.ai/server/collaboration/middleware-and-events.md).

[Back to all features](https://docs.univer.ai/overview/features.md)
