From b3ef639caf525992354684f8b353f5757c390159 Mon Sep 17 00:00:00 2001 From: Steven Zou Date: Tue, 28 Mar 2017 15:18:51 +0800 Subject: [PATCH] control the button status based on app config --- src/ui_ng/src/app/user/user.component.html | 2 +- src/ui_ng/src/app/user/user.component.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ui_ng/src/app/user/user.component.html b/src/ui_ng/src/app/user/user.component.html index 48c1987d1..fd71f7f1f 100644 --- a/src/ui_ng/src/app/user/user.component.html +++ b/src/ui_ng/src/app/user/user.component.html @@ -2,7 +2,7 @@

{{'SIDE_NAV.SYSTEM_MGMT.USER' | translate}}

- + diff --git a/src/ui_ng/src/app/user/user.component.ts b/src/ui_ng/src/app/user/user.component.ts index 471307608..ffafc8a7d 100644 --- a/src/ui_ng/src/app/user/user.component.ts +++ b/src/ui_ng/src/app/user/user.component.ts @@ -12,6 +12,7 @@ import { ConfirmationState, ConfirmationTargets } from '../shared/shared.const' import { MessageHandlerService } from '../shared/message-handler/message-handler.service'; import { SessionService } from '../shared/session.service'; +import { AppConfigService } from '../app-config.service'; @Component({ selector: 'harbor-user', @@ -37,7 +38,8 @@ export class UserComponent implements OnInit, OnDestroy { private translate: TranslateService, private deletionDialogService: ConfirmationDialogService, private msgHandler: MessageHandlerService, - private session: SessionService) { + private session: SessionService, + private appConfigService: AppConfigService) { this.deletionSubscription = deletionDialogService.confirmationConfirm$.subscribe(confirmed => { if (confirmed && confirmed.source === ConfirmationTargets.USER && @@ -62,6 +64,15 @@ export class UserComponent implements OnInit, OnDestroy { return testedItem.indexOf(terms) != -1; } + public get canCreateUser(): boolean { + let appConfig = this.appConfigService.getConfig(); + if (appConfig) { + return appConfig.auth_mode != 'ldap_auth'; + } else { + return true; + } + } + isSystemAdmin(u: User): string { if (!u) { return "{{MISS}}";