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.

feat(permission): support refresh (#2740)

Gpound.liu710e26afaac3
diff --git a/packages/sheets-ui/src/controllers/permission/sheet-permission-init.controller.ts b/packages/sheets-ui/src/controllers/permission/sheet-permission-init.controller.ts
index 6ca80ca4e5..4da1ae0588 100644
--- a/packages/sheets-ui/src/controllers/permission/sheet-permission-init.controller.ts
+++ b/packages/sheets-ui/src/controllers/permission/sheet-permission-init.controller.ts
@@ -47,7 +47,7 @@ export class SheetPermissionInitController extends Disposable {
this._initWorksheetPermissionFromSnapshot();
this._initWorksheetPermissionChange();
this._initWorksheetPermissionPointsChange();
- this._initWorkbookPermissionChange();
+ this.initWorkbookPermissionChange();
this._initUserChange();
this._initViewModelByRangeInterceptor();
this._initViewModelBySheetInterceptor();
@@ -138,9 +138,8 @@ export class SheetPermissionInitController extends Disposable {
);
}
- private _initWorkbookPermissionChange() {
- const workbook = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;
- const unitId = workbook.getUnitId();
+ public initWorkbookPermissionChange(_unitId?: string) {
+ const unitId = _unitId || this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!.getUnitId();
this._authzIoService.allowed({
objectID: unitId,
objectType: UnitObject.Workbook,
@@ -311,7 +310,7 @@ export class SheetPermissionInitController extends Disposable {
});
});
- this._initWorkbookPermissionChange();
+ this.initWorkbookPermissionChange();
this._initWorksheetPermissionFromSnapshot();
this._initRangePermissionFromSnapshot();
})
diff --git a/packages/sheets-ui/src/index.ts b/packages/sheets-ui/src/index.ts
index 92f512fa69..99fe541bd7 100644
--- a/packages/sheets-ui/src/index.ts
+++ b/packages/sheets-ui/src/index.ts
@@ -92,6 +92,7 @@ export { SheetPrintInterceptorService } from './services/print-interceptor.servi
export { UniverSheetsMobileUIPlugin } from './mobile-sheets-ui-plugin';
export { MobileSheetBar } from './views/mobile/sheet-bar/MobileSheetBar';
export { expandToContinuousRange } from './commands/commands/utils/selection-utils';
+export { SheetPermissionInitController } from './controllers/permission/sheet-permission-init.controller';
// #region - all commands
@@ -111,7 +112,8 @@ export {
export { DeleteRangeMoveLeftConfirmCommand } from './commands/commands/delete-range-move-left-confirm.command';
export { DeleteRangeMoveUpConfirmCommand } from './commands/commands/delete-range-move-up-confirm.command';
export { HideRowConfirmCommand, HideColConfirmCommand } from './commands/commands/hide-row-col-confirm.command';
-export { SetRangeBoldCommand,
+export {
+ SetRangeBoldCommand,
SetRangeItalicCommand,
SetRangeUnderlineCommand,
SetRangeStrickThroughCommand,