Skip to content

Commit 36faa04

Browse files
author
nickchecan
committed
chore: add ollama validation to session state verification
1 parent 19f73ea commit 36faa04

File tree

1 file changed

+12
-12
lines changed
  • com.developer.nefarious.zjoule.plugin/src/com/developer/nefarious/zjoule/plugin/auth

1 file changed

+12
-12
lines changed

com.developer.nefarious.zjoule.plugin/src/com/developer/nefarious/zjoule/plugin/auth/SessionManager.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,12 @@
1919
*/
2020
public abstract class SessionManager {
2121

22-
/**
23-
* Checks if the user is currently logged in.
24-
* A user is considered logged in if the following memory components are not empty:
25-
* <ul>
26-
* <li>{@link MemoryAccessToken}</li>
27-
* <li>{@link MemoryServiceKey}</li>
28-
* <li>{@link MemoryResourceGroup}</li>
29-
* <li>{@link MemoryDeployment}</li>
30-
* </ul>
31-
*
32-
* @return {@code true} if the user is logged in, {@code false} otherwise.
33-
*/
22+
3423
public static boolean isUserLoggedIn() {
24+
return (isSapSessionOn() || isOllamaSessionOn()) ? true : false;
25+
}
26+
27+
private static boolean isSapSessionOn() {
3528
MemoryAccessToken memoryAccessToken = MemoryAccessToken.getInstance();
3629
MemoryServiceKey memoryServiceKey = MemoryServiceKey.getInstance();
3730
MemoryResourceGroup memoryResourceGroup = MemoryResourceGroup.getInstance();
@@ -40,6 +33,13 @@ public static boolean isUserLoggedIn() {
4033
return (memoryAccessToken.isEmpty() || memoryServiceKey.isEmpty() || memoryResourceGroup.isEmpty()
4134
|| memoryDeployment.isEmpty()) ? false : true;
4235
}
36+
37+
private static boolean isOllamaSessionOn() {
38+
MemoryOllamaEndpoint memoryOllamaEndpoint = MemoryOllamaEndpoint.getInstance();
39+
MemoryOllamaModel memoryOllamaModel = MemoryOllamaModel.getInstance();
40+
41+
return (memoryOllamaEndpoint.isEmpty() || memoryOllamaModel.isEmpty()) ? false : true;
42+
}
4343

4444
/**
4545
* Executes the login process using the specified browser.

0 commit comments

Comments
 (0)