只有在重新登录的时候清除锁定

This commit is contained in:
heavyrian2012
2026-02-24 10:37:21 +08:00
parent 8f74e54c88
commit 969de83e1f
3 changed files with 17 additions and 7 deletions
@@ -26,6 +26,11 @@ public class GetTokenHandler extends IMHandler<WFCMessage.GetTokenRequest> {
if(userInfo != null && userInfo.getType() == 1) { if(userInfo != null && userInfo.getType() == 1) {
return ErrorCode.ERROR_CODE_ROBOT_NO_TOKEN; return ErrorCode.ERROR_CODE_ROBOT_NO_TOKEN;
} }
if((session.isPcClient() || session.isPadClient())) {
if(m_messagesStore.isLocked(session.getUsername(), session.getClientID())) {
m_messagesStore.updateUserSettings(session.getUsername(), WFCMessage.ModifyUserSettingReq.newBuilder().setScope(UserSettingScopeLockPC).setKey(session.getClientID()).setValue("0").build(), null);
}
}
TokenAuthenticator authenticator = new TokenAuthenticator(); TokenAuthenticator authenticator = new TokenAuthenticator();
String strToken = authenticator.generateToken(fromUser); String strToken = authenticator.generateToken(fromUser);
@@ -3024,13 +3024,6 @@ public class MemoryMessagesStore implements IMessagesStore {
return; return;
} }
if(!online && (session.isPcClient()) || session.isPadClient()) {
WFCMessage.UserSettingEntry lockSetting = getUserSetting(session.getUsername(), UserSettingScopeLockPC, session.getClientID());
if(lockSetting != null && "1".equals(lockSetting.getValue())) {
updateUserSettings(session.getUsername(), WFCMessage.ModifyUserSettingReq.newBuilder().setScope(UserSettingScopeLockPC).setKey(session.getClientID()).setValue("0").build(), null);
}
}
String pcValue = null; String pcValue = null;
String padValue = null; String padValue = null;
for (MemorySessionStore.Session s : m_Server.getStore().sessionsStore().sessionForUser(session.username)) { for (MemorySessionStore.Session s : m_Server.getStore().sessionsStore().sessionForUser(session.username)) {
@@ -4552,6 +4545,15 @@ public class MemoryMessagesStore implements IMessagesStore {
} }
} }
@Override
public boolean isLocked(String userId, String clientId) {
WFCMessage.UserSettingEntry lockSetting = getUserSetting(userId, UserSettingScopeLockPC, clientId);
if(lockSetting != null && "1".equals(lockSetting.getValue())) {
return true;
}
return false;
}
@Override @Override
public boolean getUserGlobalSilent(String userId) { public boolean getUserGlobalSilent(String userId) {
Boolean slient = userGlobalSlientMap.get(userId); Boolean slient = userGlobalSlientMap.get(userId);
@@ -208,6 +208,9 @@ public interface IMessagesStore {
List<WFCMessage.UserSettingEntry> getUserSetting(String userId, int scope); List<WFCMessage.UserSettingEntry> getUserSetting(String userId, int scope);
long updateUserSettings(String userId, WFCMessage.ModifyUserSettingReq request, String clientId); long updateUserSettings(String userId, WFCMessage.ModifyUserSettingReq request, String clientId);
void clearUserSettings(String userId); void clearUserSettings(String userId);
boolean isLocked(String userId, String clientId);
boolean getUserGlobalSilent(String userId); boolean getUserGlobalSilent(String userId);
boolean getUserVoipSilent(String userId); boolean getUserVoipSilent(String userId);