fix(console): bugs and some imperfections (#1557)

* org refresh, mfa name attribute

* fix org change
This commit is contained in:
Max Peintner 2021-04-08 13:11:12 +02:00 committed by GitHub
parent e1a930d535
commit e7913bde59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 41 additions and 23 deletions

View File

@ -38,6 +38,7 @@ import { WarnDialogModule } from './modules/warn-dialog/warn-dialog.module';
import { SignedoutComponent } from './pages/signedout/signedout.component'; import { SignedoutComponent } from './pages/signedout/signedout.component';
import { HasFeaturePipeModule } from './pipes/has-feature-pipe/has-feature-pipe.module'; import { HasFeaturePipeModule } from './pipes/has-feature-pipe/has-feature-pipe.module';
import { HasRolePipeModule } from './pipes/has-role-pipe/has-role-pipe.module'; import { HasRolePipeModule } from './pipes/has-role-pipe/has-role-pipe.module';
import { AuthenticationService } from './services/authentication.service';
import { GrpcAuthService } from './services/grpc-auth.service'; import { GrpcAuthService } from './services/grpc-auth.service';
import { GrpcService } from './services/grpc.service'; import { GrpcService } from './services/grpc.service';
import { AuthInterceptor } from './services/interceptors/auth.interceptor'; import { AuthInterceptor } from './services/interceptors/auth.interceptor';
@ -175,6 +176,7 @@ const authConfig: AuthConfig = {
SeoService, SeoService,
RefreshService, RefreshService,
GrpcService, GrpcService,
AuthenticationService,
GrpcAuthService, GrpcAuthService,
{ provide: 'windowObject', useValue: window }, { provide: 'windowObject', useValue: window },
], ],

View File

@ -21,5 +21,4 @@ export class AuthGuard implements CanActivate {
} }
return this.auth.authenticated; return this.auth.authenticated;
} }
} }

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { filter, first, switchMap } from 'rxjs/operators'; import { filter, switchMap } from 'rxjs/operators';
import { GrpcAuthService } from '../services/grpc-auth.service'; import { GrpcAuthService } from '../services/grpc-auth.service';
@ -18,7 +18,6 @@ export class RoleGuard implements CanActivate {
): Observable<boolean> { ): Observable<boolean> {
return this.authService.fetchedZitadelPermissions.pipe( return this.authService.fetchedZitadelPermissions.pipe(
filter((permissionsFetched) => !!permissionsFetched), filter((permissionsFetched) => !!permissionsFetched),
first(),
).pipe( ).pipe(
switchMap(_ => this.authService.isAllowed(route.data['roles'])), switchMap(_ => this.authService.isAllowed(route.data['roles'])),
); );

View File

@ -2,6 +2,7 @@ h2 {
font-size: 1.2rem; font-size: 1.2rem;
letter-spacing: .05em; letter-spacing: .05em;
text-transform: uppercase; text-transform: uppercase;
margin-top: 2rem;
} }
.top-desc { .top-desc {

View File

@ -11,6 +11,13 @@
color: var(--grey); color: var(--grey);
font-size: 14px; font-size: 14px;
} }
h2 {
font-size: 1.2rem;
letter-spacing: .05em;
text-transform: uppercase;
margin-top: 2rem;
}
.tier { .tier {
display: flex; display: flex;

View File

@ -6,6 +6,8 @@
<app-card title="{{ 'ORG.DOMAINS.TITLE' | translate }}" <app-card title="{{ 'ORG.DOMAINS.TITLE' | translate }}"
description="{{ 'ORG.DOMAINS.DESCRIPTION' | translate }}"> description="{{ 'ORG.DOMAINS.DESCRIPTION' | translate }}">
<button (click)="loadDomains()" card-actions mat-icon-button><mat-icon>refresh</mat-icon></button>
<div *ngFor="let domain of domains" class="domain"> <div *ngFor="let domain of domains" class="domain">
<span *ngIf="canwrite$ | async" (click)="verifyDomain(domain)" <span *ngIf="canwrite$ | async" (click)="verifyDomain(domain)"
class="title">{{domain.domainName}}</span> class="title">{{domain.domainName}}</span>

View File

@ -6,6 +6,7 @@ h2 {
font-size: 1.2rem; font-size: 1.2rem;
letter-spacing: .05em; letter-spacing: .05em;
text-transform: uppercase; text-transform: uppercase;
margin-top: 2rem;
} }
.top-desc { .top-desc {

View File

@ -113,12 +113,14 @@ export class OrgDetailComponent implements OnInit {
dialogRef.afterClosed().subscribe(resp => { dialogRef.afterClosed().subscribe(resp => {
if (resp) { if (resp) {
this.mgmtService.addOrgDomain(resp).then(resp => { this.mgmtService.addOrgDomain(resp).then(() => {
const newDomain = resp;
// TODO send domainname only
// this.verifyDomain(newDomainView.toObject());
this.toast.showInfo('ORG.TOAST.DOMAINADDED', true); this.toast.showInfo('ORG.TOAST.DOMAINADDED', true);
setTimeout(() => {
this.loadDomains();
}, 1000);
}).catch(error => {
this.toast.showError(error);
}); });
} }
}); });

View File

@ -9,6 +9,7 @@ import { GrantedProject, Project, Role } from 'src/app/proto/generated/zitadel/p
import { User } from 'src/app/proto/generated/zitadel/user_pb'; import { User } from 'src/app/proto/generated/zitadel/user_pb';
import { GrpcAuthService } from 'src/app/services/grpc-auth.service'; import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service'; import { ManagementService } from 'src/app/services/mgmt.service';
import { StorageKey, StorageService } from 'src/app/services/storage.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
@ -51,6 +52,7 @@ export class UserGrantCreateComponent implements OnDestroy {
private route: ActivatedRoute, private route: ActivatedRoute,
private authService: GrpcAuthService, private authService: GrpcAuthService,
private mgmtService: ManagementService, private mgmtService: ManagementService,
private storage: StorageService,
) { ) {
this.subscription = this.route.params.subscribe((params: Params) => { this.subscription = this.route.params.subscribe((params: Params) => {
const { projectid, grantid, userid } = params; const { projectid, grantid, userid } = params;
@ -83,9 +85,10 @@ export class UserGrantCreateComponent implements OnDestroy {
} }
}); });
this.authService.getActiveOrg().then(org => { const temporg = this.storage.getItem<Org.AsObject>(StorageKey.organization);
this.org = org; if (temporg) {
}); this.org = temporg;
}
} }
public close(): void { public close(): void {

View File

@ -9,10 +9,11 @@
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="attr"> <ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> {{ 'USER.MFA.ATTRIBUTE' | translate }} </th> <th mat-header-cell *matHeaderCellDef> {{ 'USER.MFA.NAME' | translate }} </th>
<td mat-cell *matCellDef="let mfa"><span *ngIf="mfa?.attribute" class="centered"> <td mat-cell *matCellDef="let mfa">
{{ mfa?.attribute }} <span *ngIf="mfa?.u2f?.name" class="centered">
{{ mfa.u2f.name }}
</span> </span>
</td> </td>
</ng-container> </ng-container>

View File

@ -26,7 +26,7 @@ export interface WebAuthNOptions {
styleUrls: ['./auth-user-mfa.component.scss'], styleUrls: ['./auth-user-mfa.component.scss'],
}) })
export class AuthUserMfaComponent implements OnInit, OnDestroy { export class AuthUserMfaComponent implements OnInit, OnDestroy {
public displayedColumns: string[] = ['type', 'attr', 'state', 'actions']; public displayedColumns: string[] = ['type', 'name', 'state', 'actions'];
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false); private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
public loading$: Observable<boolean> = this.loadingSubject.asObservable(); public loading$: Observable<boolean> = this.loadingSubject.asObservable();

View File

@ -9,10 +9,11 @@
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="attr"> <ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> {{ 'USER.MFA.ATTRIBUTE' | translate }} </th> <th mat-header-cell *matHeaderCellDef> {{ 'USER.MFA.NAME' | translate }} </th>
<td mat-cell *matCellDef="let mfa"><span *ngIf="mfa?.attribute" class="centered"> <td mat-cell *matCellDef="let mfa">
{{ mfa.attribute }} <span *ngIf="mfa?.u2f?.name" class="centered">
{{ mfa.u2f.name }}
</span> </span>
</td> </td>
</ng-container> </ng-container>

View File

@ -20,7 +20,7 @@ export interface MFAItem {
styleUrls: ['./user-mfa.component.scss'], styleUrls: ['./user-mfa.component.scss'],
}) })
export class UserMfaComponent implements OnInit, OnDestroy { export class UserMfaComponent implements OnInit, OnDestroy {
public displayedColumns: string[] = ['type', 'attr', 'state', 'actions']; public displayedColumns: string[] = ['type', 'name', 'state', 'actions'];
@Input() private user!: User.AsObject; @Input() private user!: User.AsObject;
public mfaSubject: BehaviorSubject<AuthFactor.AsObject[]> = new BehaviorSubject<AuthFactor.AsObject[]>([]); public mfaSubject: BehaviorSubject<AuthFactor.AsObject[]> = new BehaviorSubject<AuthFactor.AsObject[]>([]);
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false); private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);

View File

@ -218,7 +218,7 @@
"MFA": { "MFA": {
"TABLETYPE":"Typ", "TABLETYPE":"Typ",
"TABLESTATE":"Status", "TABLESTATE":"Status",
"ATTRIBUTE":"Attribut", "NAME":"Name",
"TABLEACTIONS":"Aktionen", "TABLEACTIONS":"Aktionen",
"TITLE": "Multifaktor-Authentisierung", "TITLE": "Multifaktor-Authentisierung",
"DESCRIPTION": "Füge einen zusätzlichen Faktor hinzu, um Dein Konto optimal zu schützen.", "DESCRIPTION": "Füge einen zusätzlichen Faktor hinzu, um Dein Konto optimal zu schützen.",

View File

@ -218,7 +218,7 @@
"MFA": { "MFA": {
"TABLETYPE":"Type", "TABLETYPE":"Type",
"TABLESTATE":"Status", "TABLESTATE":"Status",
"ATTRIBUTE":"Attribut", "NAME":"Name",
"TABLEACTIONS":"Actions", "TABLEACTIONS":"Actions",
"TITLE": "Multifactor Authentication", "TITLE": "Multifactor Authentication",
"DESCRIPTION": "Add a second factor to ensure optimal security for your account.", "DESCRIPTION": "Add a second factor to ensure optimal security for your account.",