接口: IWorkbookPermission
Workbook-level permission Facade interface
属性
| 属性 | 修饰符 | 类型 | 描述 |
|---|---|---|---|
|
|
|
Collaborator change stream | |
|
|
|
Permission snapshot change stream (BehaviorSubject, immediately provides current state on subscription) Triggers when any permission point changes | |
|
|
|
Single permission point change stream For scenarios that only care about specific permission point changes |
方法
addCollaborator()
addCollaborator(user, role): Promise<void>Add a single collaborator
参数
| 参数 | 类型 |
|---|---|
user | User$1 |
role | UnitRole$1 |
返回
Promise<void>
canEdit()
canEdit(): booleanWhether current user can edit this workbook (calculated from combined permissions)
返回
boolean
getPoint()
getPoint(point): booleanRead current value of a point (synchronous, reads from local state)
参数
| 参数 | 类型 |
|---|---|
point | WorkbookPermissionPoint |
返回
boolean
getSnapshot()
getSnapshot(): WorkbookPermissionSnapshotGet snapshot of all current points
返回
listCollaborators()
listCollaborators(): Promise<...[]>List all collaborators
返回
Promise<…[]>
removeCollaborator()
removeCollaborator(userId): Promise<void>Remove collaborator
参数
| 参数 | 类型 |
|---|---|
userId | string |
返回
Promise<void>
removeCollaborators()
removeCollaborators(userIds): Promise<void>Batch remove collaborators
参数
| 参数 | 类型 |
|---|---|
userIds | string[] |
返回
Promise<void>
setCollaborators()
setCollaborators(collaborators): Promise<void>Batch set collaborators (replace mode, overwrites existing collaborator list)
参数
| 参数 | 类型 |
|---|---|
collaborators | { role: …; user: …; }[] |
返回
Promise<void>
setEditable()
setEditable(): Promise<void>Shortcut: Set workbook to editable (equivalent to setMode(‘editor’) or owner subset)
返回
Promise<void>
setMode()
setMode(mode): Promise<void>High-level mode setting: By Owner / Editor / Viewer / Commenter semantics Internally automatically combines multiple WorkbookPermissionPoints
参数
| 参数 | 类型 |
|---|---|
mode | WorkbookMode |
返回
Promise<void>
setPoint()
setPoint(point, value): Promise<void>Low-level point operations: Directly set boolean value of a WorkbookPermissionPoint
参数
| 参数 | 类型 |
|---|---|
point | WorkbookPermissionPoint |
value | boolean |
返回
Promise<void>
setReadOnly()
setReadOnly(): Promise<void>Shortcut: Set workbook to read-only (equivalent to setMode(‘viewer’))
返回
Promise<void>
subscribe()
subscribe(listener): UnsubscribeFnCompatibility method: Simplified subscription (for users unfamiliar with RxJS) Internally implemented based on permission$ Observable
参数
| 参数 | 类型 |
|---|---|
listener | (snapshot) => void |
返回
updateCollaborator()
updateCollaborator(user, role): Promise<void>Update collaborator role and information
参数
| 参数 | 类型 |
|---|---|
user | User$1 |
role | UnitRole$1 |
返回
Promise<void>