@univerjs/facade v0.4.2 • Docs
Class: FPermission
Constructors
new FPermission()
new FPermission(
_injector,
_commandService,
_permissionService,
_worksheetProtectionRuleModel,
_rangeProtectionRuleModel,
_worksheetProtectionPointRuleModel,
_authzIoService): FPermission
Parameters
Parameter | Type |
---|---|
_injector | Injector |
_commandService | ICommandService |
_permissionService | IPermissionService |
_worksheetProtectionRuleModel | WorksheetProtectionRuleModel |
_rangeProtectionRuleModel | RangeProtectionRuleModel |
_worksheetProtectionPointRuleModel | WorksheetProtectionPointModel |
_authzIoService | IAuthzIoService |
Returns
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:22 (opens in a new tab)
Methods
addRangeBaseProtection()
addRangeBaseProtection(
unitId,
subUnitId,
ranges): Promise<undefined | {
permissionId: string;
ruleId: string;
}>
Adds a range protection to the worksheet.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook. |
subUnitId | string | The unique identifier of the worksheet. |
ranges | IRange [] | The ranges to be protected. |
Returns
Promise
<undefined
| {
permissionId
: string
;
ruleId
: string
;
}>
- Returns an object containing the
permissionId
andruleId
if the range protection is successfully added. If the operation fails or no result is returned, it resolves toundefined
. permissionId is used to stitch permission point ID,ruleId is used to store permission rules
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:168 (opens in a new tab)
addWorksheetBasePermission()
addWorksheetBasePermission(unitId, subUnitId): Promise<undefined | string>
This function is used to add a base permission for a worksheet.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook for which the permission is being set. |
subUnitId | string | The unique identifier of the worksheet for which the permission is being set. |
Returns
Promise
<undefined
| string
>
- Returns the
permissionId
if the permission is successfully added. If the operation fails or no result is returned, it resolves toundefined
.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:73 (opens in a new tab)
removeRangeProtection()
removeRangeProtection(
unitId,
subUnitId,
ruleIds): void
Removes the range protection from the worksheet.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook. |
subUnitId | string | The unique identifier of the worksheet. |
ruleIds | string [] | The rule IDs of the range protection to be removed. |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:217 (opens in a new tab)
removeWorksheetPermission()
removeWorksheetPermission(unitId, subUnitId): void
Delete the entire table protection set for the worksheet and reset the point permissions of the worksheet to true
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook for which the permission is being set. |
subUnitId | string | The unique identifier of the worksheet for which the permission is being set. |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:100 (opens in a new tab)
setPermissionDialogVisible()
setPermissionDialogVisible(visible): void
Set visibility of unauthorized pop-up window
Parameters
Parameter | Type |
---|---|
visible | boolean |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:298 (opens in a new tab)
setRangeProtectionPermissionPoint()
setRangeProtectionPermissionPoint(
unitId,
subUnitId,
permissionId,
FPointClass,
value): void
Modify the permission points of a custom area
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook. |
subUnitId | string | The unique identifier of the worksheet within the workbook. |
permissionId | string | The unique identifier of the permission that controls access to the range. |
FPointClass | RangePermissionPointConstructor | The constructor for the range permission point class. See the permission-point documentation (opens in a new tab) for more details. |
value | boolean | The new permission value to be set for the range (e.g., true for allowing access, false for restricting access). |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:246 (opens in a new tab)
setRangeProtectionRanges()
setRangeProtectionRanges(
unitId,
subUnitId,
ruleId,
ranges): void
Sets the ranges for range protection in a worksheet.
This method finds the rule by unitId, subUnitId, and ruleId, and updates the rule with the provided ranges. It checks for overlaps with existing ranges in the same subunit and shows an error message if any overlap is detected. If no overlap is found, it executes the command to update the range protection with the new ranges.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook. |
subUnitId | string | The unique identifier of the worksheet within the workbook. |
ruleId | string | The ruleId of the range protection rule that is being updated. |
ranges | IRange [] | The array of new ranges to be set for the range protection rule. |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:267 (opens in a new tab)
setWorkbookEditPermission()
setWorkbookEditPermission(unitId, value): void
This function is used to set whether the workbook can be edited
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook for which the permission is being set. |
value | boolean | A value that controls whether the workbook can be edited |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:61 (opens in a new tab)
setWorkbookPermissionPoint()
setWorkbookPermissionPoint(
unitId,
FPointClass,
value): void
Configures a specific permission point for a workbook.
This function sets or updates a permission point for a workbook identified by unitId
.
It creates a new permission point if it does not already exist, and updates the point with the provided value.
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook for which the permission is being set. |
FPointClass | WorkbookPermissionPointConstructor | The constructor function for creating a permission point instance. Other point constructors can See the permission-point documentation (opens in a new tab) for more details. |
value | boolean | The boolean value to determine whether the permission point is enabled or disabled. |
Returns
void
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:45 (opens in a new tab)
setWorksheetPermissionPoint()
setWorksheetPermissionPoint(
unitId,
subUnitId,
FPointClass,
value): Promise<undefined | string>
Sets the worksheet permission point by updating or adding the permission point for the worksheet. If the worksheet doesn't have a base permission, it creates one to used render
Parameters
Parameter | Type | Description |
---|---|---|
unitId | string | The unique identifier of the workbook. |
subUnitId | string | The unique identifier of the worksheet. |
FPointClass | WorkSheetPermissionPointConstructor | The constructor for the permission point class. See the permission-point documentation (opens in a new tab) for more details. |
value | boolean | The new permission value to be set for the worksheet. |
Returns
Promise
<undefined
| string
>
- Returns the
permissionId
if the permission point is successfully set or created. If no permission is set, it resolves toundefined
.
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-permission.ts:125 (opens in a new tab)