# Permissions

- Human documentation: [https://docs.univer.ai/guides/bases/features/core/permissions](https://docs.univer.ai/guides/bases/features/core/permissions)

- Agent Markdown: [https://docs.univer.ai/guides/bases/features/core/permissions.md](https://docs.univer.ai/guides/bases/features/core/permissions.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

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

---

Make a whole Base or individual tables, fields, records, and views read-only. Use this for reports or to allow edits to only part of the data.

Register the Bases plugin and import `@univerjs-pro/bases/facade` before using these APIs.

## Make a Base read-only

```ts
const base = univerAPI.getActiveBase()
if (!base) throw new Error('Open a Base first')

await base.getPermission().setReadOnly()
console.log(base.getPermission().canEdit()) // false

await base.getPermission().setEditable()
```

## Restrict an individual object

For example, restrict one table:

```ts
const table = base.getTables()[0]
if (!table) throw new Error('Create a table first')

await table.getPermission().setReadOnly()
await table.getPermission().setEditable()
```

Fields, records, and views also expose `getPermission()`, as do dashboards and pivot views when their plugin is registered. Enabling an object does not override a parent restriction: making a record editable cannot override a read-only table.

`setReadOnly()` and `setEditable()` return promises and require `await`. Use `base.getPermission().setObjectPermissions()` for batched changes; see [Bases Facade](https://docs.univer.ai/reference/facade/bases.md) for parameters.

## Copy, export, and comments

Base-level permissions also control copying, exporting, and commenting. For example, disable copying:

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

await base.getPermission().setPoint(UnitAction.Copy, false)
```

Use `UnitAction.Export` and `UnitAction.Comment` for export and comment permissions.

## Connect business permissions

Local permissions control editor behavior. Collaborative applications must also authorize content reads, joining collaboration, and submitting changes on the server; see [server integration](https://docs.univer.ai/server.md).

Test with an editor, viewer, and unauthorized user, checking both page actions and direct requests.
