You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LocalUser对象是线程安全的当前登录用户,除了 LinCMS 系统内的管理员用户(对应模型为UserDO)外,C端用户也需要同样设置到请求上下文中,甚至说除了用户需要设置到请求上下文中,其他数据也可能需要设置到请求上下文中。现在的 LocalUser 只能 set 和 get UserDO 类型的对象:
此问题属于 #185 的衍生问题。
LocalUser
对象是线程安全的当前登录用户,除了 LinCMS 系统内的管理员用户(对应模型为UserDO
)外,C端用户也需要同样设置到请求上下文中,甚至说除了用户需要设置到请求上下文中,其他数据也可能需要设置到请求上下文中。现在的 LocalUser 只能 set 和 getUserDO
类型的对象:lin-cms-spring-boot/src/main/java/io/github/talelin/latticy/common/LocalUser.java
Line 12 in bd6b0c8
这样 LocalUser 基本就不可复用了,如果 C 端用户同样需要设置线程安全的当前登录用户,就不得不重新封装一个类,但里面的代码除了所存储的类型基本都一样的,可以考虑把
ThreadLocal
中的泛型UserDO
类型改为Map<String, Object>
,并将类重命名为LinThreadLocal
:这样无论开发者想要在
ThreadLocal
中set
和get
什么类型的对象,就都可以通过该类来操作了。The text was updated successfully, but these errors were encountered: