ACS-8770 Update the Auth Service api docs and deprecations (#9947)

* update api docs and clean dead code

* update api docs and clean dead code

rebasing onto develop branch

* [ACS-8770] fix unit test after auth refactor

* [ACS-8770] fix sonarcube issues

* [ACS-8770] update auth service doc file

* [ACS-8770] clean up demo-shell artifacts

---------

Co-authored-by: Anton Ramanovich <Anton.Ramanovich@hyland.com>
This commit is contained in:
Denys Vuika
2025-07-21 09:16:59 -04:00
committed by GitHub
parent 45834e20f9
commit 0b90affea4
15 changed files with 99 additions and 139 deletions

View File

@@ -156,7 +156,7 @@ describe('ContentService', () => {
});
it('should take current logged user id if userId undefined ', () => {
spyOn(authService, 'getEcmUsername').and.returnValue('user1');
spyOn(authService, 'getUsername').and.returnValue('user1');
const permissionNode = new Node({
permissions: {
inherited: [

View File

@@ -84,7 +84,7 @@ export class ContentService {
*/
hasPermissions(node: Node, permission: PermissionsEnum | string, userId?: string): boolean {
let hasPermissions = false;
userId = userId ?? this.authService.getEcmUsername();
userId = userId ?? this.authService.getUsername();
const permissions = [...(node.permissions?.locallySet || []), ...(node.permissions?.inherited || [])].filter(
(currentPermission) => currentPermission.authorityId === userId

View File

@@ -274,7 +274,7 @@ describe('DropdownSitesComponent', () => {
});
it('should show only sites which logged user is member of when member relation is set', async () => {
spyOn(authService, 'getEcmUsername').and.returnValue('test');
spyOn(authService, 'getUsername').and.returnValue('test');
fixture.detectChanges();
await fixture.whenStable();
@@ -295,7 +295,7 @@ describe('DropdownSitesComponent', () => {
});
it('should show all the sites if no relation is set', async () => {
spyOn(authService, 'getEcmUsername').and.returnValue('test');
spyOn(authService, 'getUsername').and.returnValue('test');
fixture.detectChanges();
await fixture.whenStable();

View File

@@ -181,7 +181,7 @@ export class DropdownSitesComponent implements OnInit {
}
private filteredResultsByMember(sites: SitePaging): SitePaging {
const loggedUserName = this.authService.getEcmUsername();
const loggedUserName = this.authService.getUsername();
sites.list.entries = sites.list.entries.filter((site) => this.isCurrentUserMember(site, loggedUserName));
return sites;
}

View File

@@ -646,7 +646,7 @@ describe('DocumentList', () => {
title: 'FileAction'
});
spyOn(authenticationService, 'getEcmUsername').and.returnValue('lockOwner');
spyOn(authenticationService, 'getUsername').and.returnValue('lockOwner');
documentList.actions = [documentMenu];
@@ -677,7 +677,7 @@ describe('DocumentList', () => {
title: 'FileAction'
});
spyOn(authenticationService, 'getEcmUsername').and.returnValue('jerryTheKillerCow');
spyOn(authenticationService, 'getUsername').and.returnValue('jerryTheKillerCow');
documentList.actions = [documentMenu];

View File

@@ -137,22 +137,22 @@ describe('LockService', () => {
} as Node;
it('should return false when the user is the lock owner', () => {
spyOn(authenticationService, 'getEcmUsername').and.returnValue('lock-owner-user');
spyOn(authenticationService, 'getUsername').and.returnValue('lock-owner-user');
expect(service.isLocked(nodeOwnerAllowedLock)).toBeFalsy();
});
it('should return true when the user is not the lock owner', () => {
spyOn(authenticationService, 'getEcmUsername').and.returnValue('banana-user');
spyOn(authenticationService, 'getUsername').and.returnValue('banana-user');
expect(service.isLocked(nodeOwnerAllowedLock)).toBeTruthy();
});
it('should return false when the user is not the lock owner but the lock is expired', () => {
spyOn(authenticationService, 'getEcmUsername').and.returnValue('banana-user');
spyOn(authenticationService, 'getUsername').and.returnValue('banana-user');
expect(service.isLocked(nodeOwnerAllowedLockWithExpiredDate)).toBeFalsy();
});
it('should return true when is not the lock owner and the expiration date is valid', () => {
spyOn(authenticationService, 'getEcmUsername').and.returnValue('banana-user');
spyOn(authenticationService, 'getUsername').and.returnValue('banana-user');
expect(service.isLocked(nodeOwnerAllowedLockWithActiveExpiration)).toBeTruthy();
});
});

View File

@@ -32,7 +32,7 @@ export class LockService {
if (this.isReadOnlyLock(node)) {
isLocked = !this.isLockExpired(node);
} else if (this.isLockOwnerAllowed(node)) {
isLocked = this.authService.getEcmUsername() !== node.properties['cm:lockOwner'].id;
isLocked = this.authService.getUsername() !== node.properties['cm:lockOwner'].id;
if (this.isLockExpired(node)) {
isLocked = false;
}