# FBaseObjectPermission

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

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

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

- Requested language: `zh-CN`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

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

---

Command-backed Edit permission for one stable Base object.

## Access

Access through:

* [`FBaseDashboard.getPermission()`](https://docs.univer.ai/zh-CN/reference/facade/base-dashboard.md#getpermission)
* [`FBasePivotView.getPermission()`](https://docs.univer.ai/zh-CN/reference/facade/base-pivot-view.md#getpermission)
* [`FBaseTableRecord.getPermission()`](https://docs.univer.ai/zh-CN/reference/facade/base-table-record.md#getpermission)
* [`FBaseTableField.getPermission()`](https://docs.univer.ai/zh-CN/reference/facade/base-table-field.md#getpermission)
* [`FBaseTable.getPermission()`](https://docs.univer.ai/zh-CN/reference/facade/base-table.md#getpermission)
* [`FBaseTableView.getPermission()`](https://docs.univer.ai/zh-CN/reference/facade/base-table-view.md#getpermission)

## Setup

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

## `@univerjs-pro/bases`

### `FBaseObjectPermission.canEdit`

Returns the effective Edit result after applying the Base unit, parent objects, and this object.

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

**Returns**

Whether the object is currently editable.

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

### `FBaseObjectPermission.setEditable`

Enables or disables editing for this stable Base object.

This changes only the object's Edit point. `canEdit()` also applies the Base unit and parent
object ceilings, so enabling a child does not override a read-only Base or parent Table.

```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 table

```ts
const base = univerAPI.getActiveBase()
const table = base?.getTables()[0]
if (!table) throw new Error('Tasks table not found.')
await table.getPermission().setEditable()
```

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

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

### `FBaseObjectPermission.setReadOnly`

Makes this stable Base object read-only.

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

**Returns**

Resolves after the permission command finishes.

**Examples**

```ts
const table = univerAPI.getActiveBase()?.getTables()[0]
if (!table) throw new Error('Table not found.')
await table.getPermission().setReadOnly()
```

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

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