Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 90ab51c

Browse files
committed
[MNT-23143] Add withCredentials to isLoggedIn
1 parent 80106a4 commit 90ab51c

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/alfrescoApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,9 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
452452
if (this.isBpmConfiguration()) {
453453
return this.processAuth.isLoggedIn();
454454
} else if (this.isEcmConfiguration()) {
455-
return this.contentAuth.isLoggedIn();
455+
return this.config.withCredentials ? true : this.contentAuth.isLoggedIn();
456456
} else if (this.isEcmBpmConfiguration()) {
457-
return this.contentAuth.isLoggedIn() && this.processAuth.isLoggedIn();
457+
return this.config.withCredentials ? true : (this.contentAuth.isLoggedIn() && this.processAuth.isLoggedIn());
458458
} else {
459459
return false;
460460
}

test/alfrescoApi.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,28 @@ describe('Basic configuration test', () => {
107107
expect(alfrescoJsApi.isEcmLoggedIn()).equal(true);
108108
});
109109

110+
it('should withCredentials true parameter with hostEcm should be reflected in isLoggedIn', () => {
111+
const hostEcm = 'http://127.0.0.1:8080';
112+
const alfrescoJsApi = new AlfrescoApi({
113+
hostEcm,
114+
provider: 'ECM',
115+
withCredentials: true
116+
} as AlfrescoApiConfig);
117+
118+
expect(alfrescoJsApi.isLoggedIn()).equal(true);
119+
});
120+
121+
it('should withCredentials true parameter with ALL provider should be reflected in isLoggedIn', () => {
122+
const hostEcm = 'http://127.0.0.1:8080';
123+
const alfrescoJsApi = new AlfrescoApi({
124+
hostEcm,
125+
provider: 'ALL',
126+
withCredentials: true
127+
} as AlfrescoApiConfig);
128+
129+
expect(alfrescoJsApi.isLoggedIn()).equal(true);
130+
});
131+
110132
it('should withCredentials false parameter should be reflected in the clients', () => {
111133
const config = {
112134
hostEcm: 'http://testServer.com:1616',

0 commit comments

Comments
 (0)