mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-20 23:57:42 +01:00
Merge pull request #5 from steven-zou/fix/issue_1812
control the button status based on app config
This commit is contained in:
commit
0d3d3a0fb3
@ -2,7 +2,7 @@
|
||||
<h2 class="custom-h2">{{'SIDE_NAV.SYSTEM_MGMT.USER' | translate}}</h2>
|
||||
<div class="action-panel-pos">
|
||||
<span>
|
||||
<button type="submit" class="btn btn-primary custom-add-button" (click)="addNewUser()"><clr-icon shape="add"></clr-icon> {{'USER.ADD_ACTION' | translate}}</button>
|
||||
<button *ngIf="canCreateUser" type="submit" class="btn btn-primary custom-add-button" (click)="addNewUser()"><clr-icon shape="add"></clr-icon> {{'USER.ADD_ACTION' | translate}}</button>
|
||||
</span>
|
||||
<grid-filter class="filter-pos" filterPlaceholder='{{"USER.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)"></grid-filter>
|
||||
<span class="refresh-btn" (click)="refreshUser()">
|
||||
|
@ -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}}";
|
||||
|
Loading…
Reference in New Issue
Block a user