mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
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:
@@ -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: [
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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];
|
||||
|
||||
|
@@ -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();
|
||||
});
|
||||
});
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user