# FWorkbookPermission

> Language fallback: requested `ko-KR`; content is `en-US`.

- Human documentation: [https://docs.univer.ai/ko-KR/reference/facade/workbook-permission](https://docs.univer.ai/ko-KR/reference/facade/workbook-permission)

- Agent Markdown: [https://docs.univer.ai/ko-KR/reference/facade/workbook-permission.md](https://docs.univer.ai/ko-KR/reference/facade/workbook-permission.md)

- Requested language: `ko-KR`

- Content language: `en-US`

- Documentation version: `1.0.4`

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

---

Implementation class for WorkbookPermission
Provides workbook-level permission control

> This class should not be instantiated directly. Use factory methods on `univerAPI` instead.

## Access

Access through:

* [`FWorkbook.getWorkbookPermission()`](https://docs.univer.ai/ko-KR/reference/facade/workbook.md#getworkbookpermission)

## Setup

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

## `@univerjs/sheets`

### `FWorkbookPermission.addCollaborator`

Add a single collaborator.

```typescript
addCollaborator(user: ICollaboratorUser, role: UnitRole): Promise<void>
```

**Parameters**

* `user` — Required. The user information (userID, name, avatar).
* `role` — Required. The role to assign.

**Returns**

A promise that resolves when the collaborator is added.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const permission = fWorkbook.getWorkbookPermission()
await permission.addCollaborator(
  { userID: 'user1', name: 'John Doe', avatar: 'https://...' },
  univerAPI.Enum.UnitRole.Editor,
)
```

**Types:** [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64/lib/lib.es5.d.ts) · [`ICollaboratorUser`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts) · [`UnitRole`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts)

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.canEdit`

Check if the workbook is editable.

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

**Returns**

true if the workbook can be edited, false otherwise.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
if (fWorkbook.getWorkbookPermission().canEdit()) {
  console.log('Workbook is editable')
}
```

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.getPoint`

Get the value of a specific permission point.

```typescript
getPoint(point: WorkbookPermissionPoint): boolean
```

**Parameters**

* `point` — Required. The permission point to query.

**Returns**

true if allowed, false if denied.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const permission = fWorkbook.getWorkbookPermission()
const canPrint = permission.getPoint(univerAPI.Enum.WorkbookPermissionPoint.Print)
console.log(canPrint)
```

**Types:** [`WorkbookPermissionPoint`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts)

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.getSnapshot`

Get a snapshot of all permission points.

```typescript
getSnapshot(): WorkbookPermissionSnapshot
```

**Returns**

An object containing all permission point values.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const snapshot = fWorkbook.getWorkbookPermission().getSnapshot()
console.log(snapshot)
```

**Types:** [`WorkbookPermissionSnapshot`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts)

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.listCollaborators`

List all collaborators of the workbook.

```typescript
listCollaborators(): Promise<ICollaborator[]>
```

**Returns**

Array of collaborators with their roles.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const permission = fWorkbook.getWorkbookPermission()
const collaborators = await permission.listCollaborators()
console.log(collaborators)
```

**Types:** [`ICollaborator`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts) · [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64/lib/lib.es5.d.ts)

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.removeCollaborator`

Remove a collaborator from the workbook.

```typescript
removeCollaborator(userId: string): Promise<void>
```

**Parameters**

* `userId` — Required. The user ID to remove.

**Returns**

A promise that resolves when the collaborator is removed.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const permission = fWorkbook.getWorkbookPermission()
await permission.removeCollaborator('user1')
```

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

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.removeCollaborators`

Remove multiple collaborators at once.

```typescript
removeCollaborators(userIds: string[]): Promise<void>
```

**Parameters**

* `userIds` — Required. Array of user IDs to remove.

**Returns**

A promise that resolves when the collaborators are removed.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const permission = fWorkbook.getWorkbookPermission()
await permission.removeCollaborators(['user1', 'user2'])
```

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

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.setCollaborators`

Set multiple collaborators at once (replaces existing collaborators).

```typescript
setCollaborators(collaborators: Array<{ user: ICollaboratorUser; role: UnitRole; }>): Promise<void>
```

**Parameters**

* `collaborators` — Required. Array of collaborators with user information and role.

**Returns**

A promise that resolves when the collaborators are set.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const permission = fWorkbook.getWorkbookPermission()
await permission.setCollaborators([
  {
    user: { userID: 'user1', name: 'John Doe', avatar: 'https://...' },
    role: univerAPI.Enum.UnitRole.Editor,
  },
  {
    user: { userID: 'user2', name: 'Jane Smith', avatar: '' },
    role: univerAPI.Enum.UnitRole.Reader,
  },
])
```

**Types:** [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64/lib/lib.es5.d.ts) · [`Array`](https://unpkg.com/@typescript/typescript-darwin-arm64/lib/lib.es5.d.ts) · [`ICollaboratorUser`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts) · [`UnitRole`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts)

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.setEditable`

Set the workbook to editable mode (editor mode).

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

**Returns**

A promise that resolves when the mode is set.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
await fWorkbook.getWorkbookPermission().setEditable()
```

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

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.setMode`

Set permission mode for the workbook.

```typescript
setMode(mode: WorkbookMode): Promise<void>
```

**Parameters**

* `mode` — Required. The permission mode to set ('owner' | 'editor' | 'viewer' | 'commenter').

**Returns**

A promise that resolves when the mode is set.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
await fWorkbook.getWorkbookPermission().setMode('editor')
```

**Types:** [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64/lib/lib.es5.d.ts) · [`WorkbookMode`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts)

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.setPoint`

Set a specific permission point.

```typescript
setPoint(point: WorkbookPermissionPoint, value: boolean): Promise<void>
```

**Parameters**

* `point` — Required. The permission point to set.
* `value` — Required. The value to set (true = allowed, false = denied).

**Returns**

A promise that resolves when the point is set.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const permission = fWorkbook.getWorkbookPermission()
await permission.setPoint(univerAPI.Enum.WorkbookPermissionPoint.Print, false)
```

**Types:** [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64/lib/lib.es5.d.ts) · [`WorkbookPermissionPoint`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts)

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.setReadOnly`

Set the workbook to read-only mode (viewer mode).

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

**Returns**

A promise that resolves when the mode is set.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
await fWorkbook.getWorkbookPermission().setReadOnly()
```

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

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)

### `FWorkbookPermission.updateCollaborator`

Update an existing collaborator's role and information.

```typescript
updateCollaborator(user: ICollaboratorUser, role: UnitRole): Promise<void>
```

**Parameters**

* `user` — Required. The updated user information (userID, name, avatar).
* `role` — Required. The new role to assign.

**Returns**

A promise that resolves when the collaborator is updated.

**Examples**

```ts
const fWorkbook = univerAPI.getActiveWorkbook()
const permission = fWorkbook.getWorkbookPermission()
await permission.updateCollaborator(
  { userID: 'user1', name: 'John Doe Updated', avatar: 'https://...' },
  univerAPI.Enum.UnitRole.Reader,
)
```

**Types:** [`Promise`](https://unpkg.com/@typescript/typescript-darwin-arm64/lib/lib.es5.d.ts) · [`ICollaboratorUser`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts) · [`UnitRole`](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/permission-types.d.ts)

**Package:** [`@univerjs/sheets`](https://docs.univer.ai/ko-KR/reference/packages/plugins/univerjs/sheets.md) · [Type definitions](https://unpkg.com/@univerjs/sheets/lib/types/facade/permission/f-workbook-permission.d.ts)
