Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix: fix handleWorksheetRangePermissionIsEmpty error (#6821)

wpxp123456da009a83b78d
diff --git a/packages/sheets/src/facade/permission/f-range-protection-rule.ts b/packages/sheets/src/facade/permission/f-range-protection-rule.ts
index 86821f1568..f3e95461c1 100644
--- a/packages/sheets/src/facade/permission/f-range-protection-rule.ts
+++ b/packages/sheets/src/facade/permission/f-range-protection-rule.ts
@@ -39,9 +39,9 @@ export class FRangeProtectionRule {
private readonly _ranges: FRange[],
private readonly _options: IRangeProtectionOptions,
@Inject(Injector) private readonly _injector: Injector,
- @Inject(ICommandService) private readonly _commandService: ICommandService,
- @Inject(IPermissionService) private readonly _permissionService: IPermissionService,
- @Inject(IAuthzIoService) private readonly _authzIoService: IAuthzIoService,
+ @IPermissionService private readonly _permissionService: IPermissionService,
+ @IAuthzIoService private readonly _authzIoService: IAuthzIoService,
+ @ICommandService private readonly _commandService: ICommandService,
@Inject(RangeProtectionRuleModel) private readonly _rangeProtectionRuleModel: RangeProtectionRuleModel
) {}
diff --git a/packages/sheets/src/facade/permission/util.ts b/packages/sheets/src/facade/permission/util.ts
index e49c4cc211..a2aec985cb 100644
--- a/packages/sheets/src/facade/permission/util.ts
+++ b/packages/sheets/src/facade/permission/util.ts
@@ -18,7 +18,7 @@ import type { Injector } from '@univerjs/core';
import type { FRange } from '../f-range';
import type { FWorksheet } from '../f-worksheet';
import type { IRangeProtectionOptions } from './permission-types';
-import { IAuthzIoService, PermissionService, Rectangle } from '@univerjs/core';
+import { IAuthzIoService, IPermissionService, Rectangle } from '@univerjs/core';
import { ObjectScope } from '@univerjs/protocol';
import { EditStateEnum, getAllWorksheetPermissionPointByPointPanel, RangeProtectionRuleModel, ViewStateEnum, WorksheetProtectionPointModel } from '@univerjs/sheets';
import { FRangeProtectionRule } from './f-range-protection-rule';
@@ -54,7 +54,7 @@ export function determineScope(editState: EditStateEnum, viewState: ViewStateEnu
export function handleWorksheetRangePermissionIsEmpty(injector: Injector, unitId: string, subUnitId: string): void {
const rangeProtectionRuleModel = injector.get(RangeProtectionRuleModel);
const worksheetProtectionPointModel = injector.get(WorksheetProtectionPointModel);
- const permissionService = injector.get(PermissionService);
+ const permissionService = injector.get(IPermissionService);
const rules = rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId);
if (rules.length > 0) {