[AAE-12501] Replace sitesService with authentication service since sitesService get the username from oauth2Auth

This commit is contained in:
Amedeo Lepore
2023-03-31 12:12:02 +02:00
parent b9ceb7f758
commit b50aee4b6e
@@ -16,7 +16,7 @@
*/
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { LogService, InfiniteSelectScrollDirective } from '@alfresco/adf-core';
import { LogService, InfiniteSelectScrollDirective, AuthenticationService } from '@alfresco/adf-core';
import { SitePaging, SiteEntry } from '@alfresco/js-api';
import { MatSelectChange } from '@angular/material/select';
import {LiveAnnouncer} from '@angular/cdk/a11y';
@@ -81,7 +81,8 @@ export class DropdownSitesComponent implements OnInit {
selected: SiteEntry = null;
MY_FILES_VALUE = '-my-';
constructor(private sitesService: SitesService,
constructor(private authService: AuthenticationService,
private sitesService: SitesService,
private logService: LogService,
private liveAnnouncer: LiveAnnouncer,
private translateService: TranslateService) {
@@ -174,7 +175,7 @@ export class DropdownSitesComponent implements OnInit {
}
private filteredResultsByMember(sites: SitePaging): SitePaging {
const loggedUserName = this.sitesService.getEcmCurrentLoggedUserName();
const loggedUserName = this.authService.getEcmUsername();
sites.list.entries = sites.list.entries.filter((site) => this.isCurrentUserMember(site, loggedUserName));
return sites;
}