mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
Update branch for ADF 6.0.0-A.2-8187 and JS-API 5.4.0-639 [ci:force] (#2991)
* [ci:force][auto-commit] Update @alfresco/js-api to 5.4.0-639 for branch: update-alfresco-dependencies originated from @alfresco/js-api PR: 4185259640 * [ci:force][auto-commit] Update @alfresco/adf-extensions to 6.0.0-A.2-8187 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 4185259640 * [ci:force][auto-commit] Update @alfresco/adf-core to 6.0.0-A.2-8187 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 4185259640 * [ci:force][auto-commit] Update @alfresco/adf-content-services to 6.0.0-A.2-8187 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 4185259640 * [ci:force][auto-commit] Update @alfresco/adf-cli to 6.0.0-A.2-8187 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 4185259640 * [ci:force][auto-commit] Update @alfresco/adf-testing to 6.0.0-A.2-8187 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 4185259640 * [AAE-10779] fix user-info refactor bc --------- Co-authored-by: Diogo Bastos <diogo.bastos@hyland.com>
This commit is contained in:
@@ -33,8 +33,7 @@ import {
|
||||
DebugAppConfigService,
|
||||
AuthGuardEcm,
|
||||
LanguagePickerComponent,
|
||||
NotificationHistoryComponent,
|
||||
UserInfoComponent
|
||||
NotificationHistoryComponent
|
||||
} from '@alfresco/adf-core';
|
||||
import {
|
||||
ContentModule,
|
||||
@@ -121,6 +120,7 @@ import { AppTrashcanModule } from './components/trashcan/trashcan.module';
|
||||
import { AppSharedLinkViewModule } from './components/shared-link-view/shared-link-view.module';
|
||||
import { AcaFolderRulesModule } from '@alfresco/aca-folder-rules';
|
||||
import { TagsColumnComponent } from './components/dl-custom-components/tags-column/tags-column.component';
|
||||
import { UserInfoComponent } from './components/common/user-info/user-info.component';
|
||||
|
||||
registerLocaleData(localeFr);
|
||||
registerLocaleData(localeDe);
|
||||
|
@@ -32,10 +32,20 @@ import { LocationLinkComponent } from './location-link/location-link.component';
|
||||
import { ToggleSharedComponent } from './toggle-shared/toggle-shared.component';
|
||||
import { LanguagePickerComponent } from './language-picker/language-picker.component';
|
||||
import { LogoutComponent } from './logout/logout.component';
|
||||
import { ContentModule } from '@alfresco/adf-content-services';
|
||||
import { UserInfoComponent } from './user-info/user-info.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, CoreModule.forChild(), ExtensionsModule, GenericErrorModule],
|
||||
declarations: [LocationLinkComponent, ToggleSharedComponent, LanguagePickerComponent, LogoutComponent],
|
||||
exports: [ExtensionsModule, LocationLinkComponent, GenericErrorModule, ToggleSharedComponent, LanguagePickerComponent, LogoutComponent]
|
||||
imports: [CommonModule, CoreModule.forChild(), ContentModule.forChild(), ExtensionsModule, GenericErrorModule],
|
||||
declarations: [LocationLinkComponent, ToggleSharedComponent, LanguagePickerComponent, LogoutComponent, UserInfoComponent],
|
||||
exports: [
|
||||
ExtensionsModule,
|
||||
LocationLinkComponent,
|
||||
GenericErrorModule,
|
||||
ToggleSharedComponent,
|
||||
LanguagePickerComponent,
|
||||
LogoutComponent,
|
||||
UserInfoComponent
|
||||
]
|
||||
})
|
||||
export class AppCommonModule {}
|
||||
|
@@ -0,0 +1,14 @@
|
||||
<ng-container>
|
||||
<adf-content-user-info
|
||||
*ngIf="mode === userInfoMode.CONTENT || mode === userInfoMode.CONTENT_SSO"
|
||||
[ecmUser]="ecmUser$ | async"
|
||||
[identityUser]="identityUser$ | async"
|
||||
[isLoggedIn]="isLoggedIn"
|
||||
[mode]="mode"
|
||||
></adf-content-user-info>
|
||||
<adf-identity-user-info
|
||||
*ngIf="mode === userInfoMode.SSO"
|
||||
[identityUser]="identityUser$ | async"
|
||||
[isLoggedIn]="isLoggedIn"
|
||||
></adf-identity-user-info>
|
||||
</ng-container>
|
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
|
||||
import { EcmUserModel, IdentityUserModel, PeopleContentService, IdentityUserService, AuthenticationService, UserInfoMode } from '@alfresco/adf-core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-info',
|
||||
templateUrl: './user-info.component.html'
|
||||
})
|
||||
export class UserInfoComponent implements OnInit {
|
||||
mode: UserInfoMode;
|
||||
ecmUser$: Observable<EcmUserModel>;
|
||||
identityUser$: Observable<IdentityUserModel>;
|
||||
selectedIndex: number;
|
||||
userInfoMode = UserInfoMode;
|
||||
|
||||
constructor(
|
||||
private peopleContentService: PeopleContentService,
|
||||
private identityUserService: IdentityUserService,
|
||||
private authService: AuthenticationService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.getUserInfo();
|
||||
}
|
||||
|
||||
getUserInfo() {
|
||||
if (this.authService.isOauth()) {
|
||||
this.loadIdentityUserInfo();
|
||||
this.mode = UserInfoMode.SSO;
|
||||
|
||||
if (this.authService.isECMProvider() && this.authService.isEcmLoggedIn()) {
|
||||
this.mode = UserInfoMode.CONTENT_SSO;
|
||||
this.loadEcmUserInfo();
|
||||
}
|
||||
} else if (this.isEcmLoggedIn()) {
|
||||
this.loadEcmUserInfo();
|
||||
this.mode = UserInfoMode.CONTENT;
|
||||
}
|
||||
}
|
||||
|
||||
get isLoggedIn(): boolean {
|
||||
if (this.authService.isKerberosEnabled()) {
|
||||
return true;
|
||||
}
|
||||
return this.authService.isLoggedIn();
|
||||
}
|
||||
|
||||
private loadEcmUserInfo(): void {
|
||||
this.ecmUser$ = this.peopleContentService.getCurrentUserInfo();
|
||||
}
|
||||
|
||||
private loadIdentityUserInfo() {
|
||||
this.identityUser$ = of(this.identityUserService.getCurrentUserInfo());
|
||||
}
|
||||
|
||||
private isEcmLoggedIn() {
|
||||
return this.authService.isEcmLoggedIn() || (this.authService.isECMProvider() && this.authService.isKerberosEnabled());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user