Closed LiuYuLu closed 1 week ago
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Origin Title: [Bug] 调用userManagerService.setCurrentUser方法后设置的用户,创建保护后,显示的创建人不是设置的用户
Title: [Bug] After the user is set after calling the userManagerService.setCurrentUser method, after the protection is created, the creator displayed is not the set user.
0.1.15
https://stackblitz.com/~/github.com/awesome-univer/sheets-permission-demo
After the setCurrentUser method is called, the person operating the record should be the person in the setting
The user set after calling the userManagerService.setCurrentUser method. After the protection is created, the creator displayed is not the set user.
Others (please explain in the reproduction steps)
No response
改造 2 个地方试试这样. 第一个地方,我们在mock权限体系的时候,通过在userID 中注入特别的字符来标明身份
第二个地方,在mock权限io的时候,会设置用户身份,你得确保你设置的mockUser的时序在这个之后。
所以你需要提前injector.get,来触发 AuthzIoLocalService 的实例化(这部分实例化逻辑是交给di框架的,如果没有手动get,那么实例化的时机会在你创建区域保护规则的时候执行.)
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Try this to remodel 2 places. First, when we mock the permission system, we indicate the identity by injecting special characters into the userID.
The second place is that when mocking permission io, the user identity will be set. You have to make sure that the timing of the mockUser you set is after this.
So you need to injector.get in advance to trigger the instantiation of AuthzIoLocalService (this part of the instantiation logic is handed over to the di framework. If there is no manual get, the instantiation will be executed when you create the regional protection rule.)
在您提交此问题之前,您是否检查了以下内容?
受影响的包和版本
0.1.15
复现链接
https://stackblitz.com/~/github.com/awesome-univer/sheets-permission-demo
预期行为
setCurrentUser方法调用后,操作记录的人应该是设置中的人
实际行为
调用userManagerService.setCurrentUser方法后设置的用户,创建保护后,显示的创建人不是设置的用户
运行环境
其他 (请在复现步骤中说明)
系统信息
No response