# FDocumentObjectPermission

> Language fallback: requested `zh-CN`; content is `en-US`.

- Human documentation: [https://docs.univer.ai/zh-CN/reference/facade/document-object-permission](https://docs.univer.ai/zh-CN/reference/facade/document-object-permission)

- Agent Markdown: [https://docs.univer.ai/zh-CN/reference/facade/document-object-permission.md](https://docs.univer.ai/zh-CN/reference/facade/document-object-permission.md)

- Requested language: `zh-CN`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [facade/document-object-permission.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/facade/document-object-permission.mdx)

---

Command-backed Edit permission for one stable Document object.

## Access

Access through:

* [`FDocumentParagraph.getPermission()`](https://docs.univer.ai/zh-CN/reference/facade/document-paragraph.md#getpermission)
* [`FDocument.getEntityPermission()`](https://docs.univer.ai/zh-CN/reference/facade/document.md#getentitypermission)
* [`FDocumentSection.getPermission()`](https://docs.univer.ai/zh-CN/reference/facade/document-section.md#getpermission)

## Setup

Register [`@univerjs/docs`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs/docs.md) or a preset that includes it. In plugin mode, import `@univerjs/docs/facade`. Additional methods below require their listed plugin packages. See [Facade setup](https://docs.univer.ai/zh-CN/guides/docs/getting-started/facade.md).

## `@univerjs/docs`

### `FDocumentObjectPermission.canEdit`

Returns the effective Edit result after applying the Document, parent, and object permissions.

```typescript
canEdit(): boolean
```

**Returns**

Whether the object is currently editable.

**Package:** [`@univerjs/docs`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs/docs.md) · [Type definitions](https://unpkg.com/@univerjs/docs@1.0.0-rc.0/lib/types/facade/f-document-permission.d.ts)

### `FDocumentObjectPermission.setEditable`

Enables or disables editing for this stable Document object.

This changes only the object's Edit point. `canEdit()` also applies the Document unit and
parent Section or Paragraph ceilings.

```typescript
setEditable(editable?: boolean): Promise<void>
```

**Parameters**

* `editable` — Optional. Default: `true`. Whether object editing is allowed. Defaults to true.

**Returns**

Resolves after the permission command finishes.

**Examples**

Restore editing for a paragraph

```ts
const document = univerAPI.getActiveDocument()
const paragraph = document?.getParagraphs()[0]
if (!paragraph) throw new Error('Paragraph not found.')
await paragraph.getPermission().setEditable()
```

**Types:** [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts)

**Package:** [`@univerjs/docs`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs/docs.md) · [Type definitions](https://unpkg.com/@univerjs/docs@1.0.0-rc.0/lib/types/facade/f-document-permission.d.ts)

### `FDocumentObjectPermission.setReadOnly`

Makes this stable Document object read-only.

```typescript
setReadOnly(): Promise<void>
```

**Returns**

Resolves after the permission command finishes.

**Examples**

```ts
const document = univerAPI.getActiveDocument()
const section = document?.getSection(0)
if (!section) throw new Error('Section not found.')
await section.getPermission().setReadOnly()
```

**Types:** [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64@7.0.2/lib/lib.es5.d.ts)

**Package:** [`@univerjs/docs`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs/docs.md) · [Type definitions](https://unpkg.com/@univerjs/docs@1.0.0-rc.0/lib/types/facade/f-document-permission.d.ts)
