chore!: Introduce ZITADEL v3 (#9645)

This PR summarizes multiple changes specifically only available with
ZITADEL v3:

- feat: Web Keys management
(https://github.com/zitadel/zitadel/pull/9526)
- fix(cmd): ensure proper working of mirror
(https://github.com/zitadel/zitadel/pull/9509)
- feat(Authz): system user support for permission check v2
(https://github.com/zitadel/zitadel/pull/9640)
- chore(license): change from Apache to AGPL
(https://github.com/zitadel/zitadel/pull/9597)
- feat(console): list v2 sessions
(https://github.com/zitadel/zitadel/pull/9539)
- fix(console): add loginV2 feature flag
(https://github.com/zitadel/zitadel/pull/9682)
- fix(feature flags): allow reading "own" flags
(https://github.com/zitadel/zitadel/pull/9649)
- feat(console): add Actions V2 UI
(https://github.com/zitadel/zitadel/pull/9591)

BREAKING CHANGE
- feat(webkey): migrate to v2beta API
(https://github.com/zitadel/zitadel/pull/9445)
- chore!: remove CockroachDB Support
(https://github.com/zitadel/zitadel/pull/9444)
- feat(actions): migrate to v2beta API
(https://github.com/zitadel/zitadel/pull/9489)

---------

Co-authored-by: Livio Spring <[email protected]>
Co-authored-by: Stefan Benz <[email protected]>
Co-authored-by: Silvan <[email protected]>
Co-authored-by: Ramon <[email protected]>
Co-authored-by: Elio Bischof <[email protected]>
Co-authored-by: Kenta Yamaguchi <[email protected]>
Co-authored-by: Harsha Reddy <[email protected]>
Co-authored-by: Livio Spring <[email protected]>
Co-authored-by: Max Peintner <[email protected]>
Co-authored-by: Iraq <[email protected]>
Co-authored-by: Florian Forster <[email protected]>
Co-authored-by: Tim Möhlmann <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Max Peintner <[email protected]>
This commit is contained in:
Fabienne Bühler
2025-04-02 16:53:06 +02:00
committed by GitHub
co-authored by Livio Spring Stefan Benz Silvan Ramon Elio Bischof Kenta Yamaguchi Harsha Reddy Livio Spring Max Peintner Iraq Florian Forster Tim Möhlmann Copilot Max Peintner
parent d14a23ae7e
commit 07ce3b6905
559 changed files with 14578 additions and 7622 deletions
@@ -2,7 +2,6 @@
[hideRefresh]="true"
[loading]="loading$ | async"
(refreshed)="refreshPage()"
[dataSize]="dataSource.data.length"
[timestamp]="actionsResult?.details?.viewTimestamp"
[selection]="selection"
>
@@ -14,6 +14,12 @@ const routes: Routes = [
data: {
roles: ['iam.read'],
},
children: [
{
path: 'actions',
loadChildren: () => import('src/app/modules/actions-two/actions-two.module'),
},
],
},
{
path: 'members',
@@ -40,12 +40,10 @@
<div class="max-width-container">
<div class="instance-settings-wrapper">
<ng-container *ngIf="settingsList | async as list">
<cnsl-settings-list
[selectedId]="id"
[serviceType]="PolicyComponentServiceType.ADMIN"
[settingsList]="list"
></cnsl-settings-list>
<ng-container *ngIf="settingsList$ | async as list">
<cnsl-settings-list [selectedId]="id" [serviceType]="PolicyComponentServiceType.ADMIN" [settingsList]="list">
<router-outlet />
</cnsl-settings-list>
</ng-container>
</div>
</div>
@@ -1,8 +1,8 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Component, DestroyRef } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { BehaviorSubject, from, Observable, of, Subject } from 'rxjs';
import { catchError, finalize, map, takeUntil } from 'rxjs/operators';
import { BehaviorSubject, defer, from, Observable, of, shareReplay, TimeoutError } from 'rxjs';
import { catchError, finalize, map, timeout } from 'rxjs/operators';
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
import { InstanceDetail, State } from 'src/app/proto/generated/zitadel/instance_pb';
@@ -24,6 +24,7 @@ import {
MESSAGETEXTS,
NOTIFICATIONS,
OIDC,
WEBKEYS,
PRIVACYPOLICY,
SECRETS,
SECURITY,
@@ -34,28 +35,35 @@ import {
EVENTS,
ORGANIZATIONS,
FEATURESETTINGS,
} from '../../modules/settings-list/settings';
ACTIONS,
ACTIONS_TARGETS,
} from 'src/app/modules/settings-list/settings';
import { SidenavSetting } from 'src/app/modules/sidenav/sidenav.component';
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { EnvironmentService } from 'src/app/services/environment.service';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { NewFeatureService } from '../../services/new-feature.service';
import { withLatestFromSynchronousFix } from '../../utils/withLatestFromSynchronousFix';
@Component({
selector: 'cnsl-instance',
templateUrl: './instance.component.html',
styleUrls: ['./instance.component.scss'],
})
export class InstanceComponent implements OnInit, OnDestroy {
public instance?: InstanceDetail.AsObject;
public PolicyComponentServiceType: any = PolicyComponentServiceType;
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
public totalMemberResult: number = 0;
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
public State: any = State;
export class InstanceComponent {
protected instance?: InstanceDetail.AsObject;
protected readonly PolicyComponentServiceType = PolicyComponentServiceType;
private readonly loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
protected readonly loading$: Observable<boolean> = this.loadingSubject.asObservable();
protected totalMemberResult: number = 0;
protected readonly membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
protected readonly State = State;
public id: string = '';
public defaultSettingsList: SidenavSetting[] = [
protected id: string = '';
protected readonly defaultSettingsList: SidenavSetting[] = [
ORGANIZATIONS,
FEATURESETTINGS,
ACTIONS,
ACTIONS_TARGETS,
// notifications
// { showWarn: true, ...NOTIFICATIONS },
NOTIFICATIONS,
@@ -67,7 +75,6 @@ export class InstanceComponent implements OnInit, OnDestroy {
COMPLEXITY,
AGE,
LOCKOUT,
DOMAIN,
// appearance
BRANDING,
@@ -81,23 +88,25 @@ export class InstanceComponent implements OnInit, OnDestroy {
PRIVACYPOLICY,
LANGUAGES,
OIDC,
WEBKEYS,
SECRETS,
SECURITY,
];
public settingsList: Observable<SidenavSetting[]> = of([]);
public customerPortalLink$ = this.envService.env.pipe(map((env) => env.customer_portal));
protected readonly settingsList$: Observable<SidenavSetting[]>;
protected readonly customerPortalLink$ = this.envService.env.pipe(map((env) => env.customer_portal));
private destroy$: Subject<void> = new Subject();
constructor(
public adminService: AdminService,
private dialog: MatDialog,
private toast: ToastService,
protected readonly adminService: AdminService,
private readonly dialog: MatDialog,
private readonly toast: ToastService,
breadcrumbService: BreadcrumbService,
private router: Router,
private authService: GrpcAuthService,
private envService: EnvironmentService,
private readonly router: Router,
private readonly authService: GrpcAuthService,
private readonly envService: EnvironmentService,
activatedRoute: ActivatedRoute,
private readonly destroyRef: DestroyRef,
private readonly featureService: NewFeatureService,
) {
this.loadMembers();
@@ -106,7 +115,6 @@ export class InstanceComponent implements OnInit, OnDestroy {
name: 'Instance',
routerLink: ['/instance'],
});
breadcrumbService.setBreadcrumb([instanceBread]);
this.adminService
@@ -120,12 +128,43 @@ export class InstanceComponent implements OnInit, OnDestroy {
this.toast.showError(error);
});
activatedRoute.queryParams.pipe(takeUntil(this.destroy$)).subscribe((params: Params) => {
const { id } = params;
activatedRoute.queryParamMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params) => {
const id = params.get('id');
if (id) {
this.id = id;
}
});
this.settingsList$ = this.getSettingsList();
}
private getSettingsList(): Observable<SidenavSetting[]> {
const features$ = this.getFeatures().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
const actionsEnabled$ = features$.pipe(map((features) => features?.actions?.enabled));
return this.authService
.isAllowedMapper(this.defaultSettingsList, (setting) => setting.requiredRoles.admin || [])
.pipe(
withLatestFromSynchronousFix(actionsEnabled$),
map(([settings, actionsEnabled]) =>
settings
.filter((setting) => actionsEnabled || setting.id !== ACTIONS.id)
.filter((setting) => actionsEnabled || setting.id !== ACTIONS_TARGETS.id),
),
);
}
private getFeatures() {
return defer(() => this.featureService.getInstanceFeatures()).pipe(
timeout(1000),
catchError((error) => {
if (!(error instanceof TimeoutError)) {
this.toast.showError(error);
}
return of(undefined);
}),
);
}
public loadMembers(): void {
@@ -185,18 +224,6 @@ export class InstanceComponent implements OnInit, OnDestroy {
}
public showDetail(): void {
this.router.navigate(['/instance', 'members']);
}
ngOnInit(): void {
this.settingsList = this.authService.isAllowedMapper(
this.defaultSettingsList,
(setting) => setting.requiredRoles.admin || [],
);
}
ngOnDestroy(): void {
this.destroy$.next();
this.destroy$.complete();
this.router.navigate(['/instance', 'members']).then();
}
}
@@ -1,6 +1,6 @@
<cnsl-top-view
title="{{ app?.name }}"
[hasActions]="isZitadel === false && (['project.app.write:' + projectId, 'project.app.write'] | hasRole | async)"
[hasActions]="!isZitadel && (['project.app.write:' + projectId, 'project.app.write'] | hasRole | async)"
docLink="https://zitadel.com/docs/guides/manage/console/projects"
[sub]="app?.oidcConfig ? ('APP.OIDC.APPTYPE.' + app?.oidcConfig?.appType | translate) : app?.apiConfig ? 'API' : 'SAML'"
[isActive]="app?.state === AppState.APP_STATE_ACTIVE"
@@ -10,43 +10,38 @@
<ng-template topActions cnslHasRole [hasRole]="['project.app.write:' + projectId, 'project.app.write']">
<div
class="regen-secret"
*ngIf="isZitadel === false && this.app?.oidcConfig && (currentAuthMethod === 'CODE' || currentAuthMethod === 'POST')"
*ngIf="!isZitadel && this.app?.oidcConfig && (currentAuthMethod === 'CODE' || currentAuthMethod === 'POST')"
>
<button type="button" [disabled]="!canWrite" mat-menu-item (click)="regenerateOIDCClientSecret()">
{{ 'APP.OIDC.REGENERATESECRET' | translate }}
</button>
</div>
<div class="regen-secret" *ngIf="isZitadel === false && this.app?.apiConfig && currentAuthMethod === 'BASIC'">
<div class="regen-secret" *ngIf="!isZitadel && this.app?.apiConfig && currentAuthMethod === 'BASIC'">
<button [disabled]="!canWrite" mat-menu-item (click)="regenerateAPIClientSecret()">
{{ 'APP.API.REGENERATESECRET' | translate }}
</button>
</div>
<button *ngIf="isZitadel === false" mat-menu-item (click)="openNameDialog()" aria-label="Edit project name">
<button *ngIf="!isZitadel" mat-menu-item (click)="openNameDialog()" aria-label="Edit project name">
{{ 'ACTIONS.RENAME' | translate }}
</button>
<button
mat-menu-item
*ngIf="isZitadel === false && app?.state !== AppState.APP_STATE_INACTIVE"
*ngIf="!isZitadel && app?.state !== AppState.APP_STATE_INACTIVE"
(click)="changeState(AppState.APP_STATE_INACTIVE)"
>
{{ 'ACTIONS.DEACTIVATE' | translate }}
</button>
<button
mat-menu-item
*ngIf="isZitadel === false && app?.state === AppState.APP_STATE_INACTIVE"
*ngIf="!isZitadel && app?.state === AppState.APP_STATE_INACTIVE"
(click)="changeState(AppState.APP_STATE_ACTIVE)"
>
{{ 'ACTIONS.REACTIVATE' | translate }}
</button>
<ng-template cnslHasRole [hasRole]="['project.app.delete:' + projectId, 'project.app.delete']">
<button
*ngIf="isZitadel === false"
mat-menu-item
matTooltip="{{ 'APP.PAGES.DELETE' | translate }}"
(click)="deleteApp()"
>
<button *ngIf="!isZitadel" mat-menu-item matTooltip="{{ 'APP.PAGES.DELETE' | translate }}" (click)="deleteApp()">
<span [style.color]="'var(--warn)'">{{ 'APP.PAGES.DELETE' | translate }}</span>
</button>
</ng-template>
@@ -80,8 +75,8 @@
<div class="app-main-content">
<cnsl-meta-layout>
<cnsl-sidenav [(ngModel)]="currentSetting" [settingsList]="settingsList">
<ng-container *ngIf="currentSetting === 'configuration'">
<cnsl-sidenav [(setting)]="currentSetting" [settingsList]="settingsList">
<ng-container *ngIf="currentSetting.id === 'configuration'">
<cnsl-card *ngIf="oidcForm && app?.oidcConfig" title=" {{ 'APP.OIDC.TITLE' | translate }}">
<div
class="current-auth-method"
@@ -274,7 +269,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'token'">
<ng-container *ngIf="currentSetting.id === 'token'">
<cnsl-card *ngIf="oidcTokenForm && app?.oidcConfig" title=" {{ 'APP.OIDC.TOKENSECTIONTITLE' | translate }}">
<form [formGroup]="oidcTokenForm" (ngSubmit)="saveOIDCApp()">
<cnsl-form-field class="app-formfield">
@@ -355,7 +350,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'redirect-uris'">
<ng-container *ngIf="currentSetting.id === 'redirect-uris'">
<cnsl-card title=" {{ 'APP.OIDC.REDIRECTSECTIONTITLE' | translate }}">
<cnsl-info-section *ngIf="appType?.value === OIDCAppType.OIDC_APP_TYPE_NATIVE">
<div class="dev-col">
@@ -435,7 +430,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'additional-origins'">
<ng-container *ngIf="currentSetting.id === 'additional-origins'">
<cnsl-card title=" {{ 'APP.ADDITIONALORIGINS' | translate }}">
<p class="app-desc cnsl-secondary-text">{{ 'APP.ADDITIONALORIGINSDESC' | translate }}</p>
<cnsl-additional-origins
@@ -456,7 +451,7 @@
</div>
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'urls'">
<ng-container *ngIf="currentSetting.id === 'urls'">
<cnsl-card title=" {{ 'APP.URLS' | translate }}">
<cnsl-info-section *ngIf="issuer$ | async as issuer">
<div
@@ -502,7 +497,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'configuration'">
<ng-container *ngIf="currentSetting.id === 'configuration'">
<cnsl-card
*ngIf="initialAuthMethod === 'PK_JWT' && projectId && app && app.id"
title="{{ 'USER.MACHINE.KEYSTITLE' | translate }}"
@@ -73,7 +73,6 @@ export class AppDetailComponent implements OnInit, OnDestroy {
public canWrite: boolean = false;
public errorMessage: string = '';
public removable: boolean = true;
public addOnBlur: boolean = true;
public readonly separatorKeysCodes: number[] = [ENTER, COMMA, SPACE];
@@ -168,21 +167,20 @@ export class AppDetailComponent implements OnInit, OnDestroy {
public isZitadel: boolean = false;
public docs!: GetOIDCInformationResponse.AsObject;
public OIDCAppType: any = OIDCAppType;
public OIDCAuthMethodType: any = OIDCAuthMethodType;
public APIAuthMethodType: any = APIAuthMethodType;
public OIDCTokenType: any = OIDCTokenType;
public OIDCGrantType: any = OIDCGrantType;
public OIDCAppType = OIDCAppType;
public OIDCAuthMethodType = OIDCAuthMethodType;
public APIAuthMethodType = APIAuthMethodType;
public OIDCTokenType = OIDCTokenType;
public OIDCGrantType = OIDCGrantType;
public ChangeType: any = ChangeType;
public ChangeType = ChangeType;
public requestRedirectValuesSubject$: Subject<void> = new Subject();
public copiedKey: any = '';
public InfoSectionType: any = InfoSectionType;
public InfoSectionType = InfoSectionType;
public copied: string = '';
public settingsList: SidenavSetting[] = [{ id: 'configuration', i18nKey: 'APP.CONFIGURATION' }];
public currentSetting: string | undefined = this.settingsList[0].id;
public currentSetting = this.settingsList[0];
public isNew = signal<boolean>(false);
@@ -305,7 +303,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
if (projectId && appId) {
this.projectId = projectId;
this.appId = appId;
this.getData(projectId, appId);
this.getData(projectId, appId).then();
}
}
@@ -395,7 +393,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
if (this.initialAuthMethod === 'BASIC') {
this.settingsList = [{ id: 'urls', i18nKey: 'APP.URLS' }];
this.currentSetting = 'urls';
this.currentSetting = this.settingsList[0];
} else {
this.settingsList = [
{ id: 'configuration', i18nKey: 'APP.CONFIGURATION' },
@@ -742,13 +740,13 @@ export class AppDetailComponent implements OnInit, OnDestroy {
if (this.currentAuthMethod === 'BASIC') {
this.settingsList = [{ id: 'urls', i18nKey: 'APP.URLS' }];
this.currentSetting = 'urls';
this.currentSetting = this.settingsList[0];
} else {
this.settingsList = [
{ id: 'configuration', i18nKey: 'APP.CONFIGURATION' },
{ id: 'urls', i18nKey: 'APP.URLS' },
];
this.currentSetting = 'configuration';
this.currentSetting = this.settingsList[0];
}
}
this.toast.showInfo('APP.TOAST.APIUPDATED', true);
@@ -2,7 +2,6 @@
[loading]="dataSource.loading$ | async"
[selection]="selection"
(refreshed)="refreshPage()"
[dataSize]="dataSource.totalResult"
[timestamp]="dataSource.viewTimestamp"
>
<ng-template cnslHasRole [hasRole]="['project.app.write']" actions>
@@ -66,8 +66,8 @@
<div class="max-width-container">
<cnsl-meta-layout>
<cnsl-sidenav [(ngModel)]="currentSetting" [settingsList]="settingsList" [queryParam]="'id'">
<ng-container *ngIf="currentSetting === 'general' && project">
<cnsl-sidenav [(setting)]="currentSetting" [settingsList]="settingsList">
<ng-container *ngIf="currentSetting.id === 'general' && project">
<ng-template cnslHasRole [hasRole]="['project.app.read:' + project.id, 'project.app.read$']">
<cnsl-application-grid
*ngIf="grid"
@@ -91,7 +91,7 @@
</cnsl-card>
</ng-template>
<ng-container *ngIf="isZitadel === false">
<ng-container *ngIf="!isZitadel">
<ng-template cnslHasRole [hasRole]="['project.role.read:' + project.id, 'project.role.read']">
<cnsl-card
id="roles"
@@ -160,7 +160,7 @@
</ng-container>
</ng-container>
<ng-container *ngIf="currentSetting === 'roles'">
<ng-container *ngIf="currentSetting.id === 'roles'">
<h2 class="section-h2">{{ 'PROJECT.ROLE.TITLE' | translate }}</h2>
<p class="desc cnsl-secondary-text">{{ 'PROJECT.ROLE.DESCRIPTION' | translate }}</p>
@@ -172,12 +172,12 @@
>
</cnsl-project-roles-table>
</ng-container>
<ng-container *ngIf="currentSetting === 'projectgrants'">
<ng-container *ngIf="currentSetting.id === 'projectgrants'">
<h2 class="section-h2">{{ 'PROJECT.GRANT.TITLE' | translate }}</h2>
<p class="desc cnsl-secondary-text">{{ 'PROJECT.GRANT.DESCRIPTION' | translate }}</p>
<cnsl-project-grants [projectId]="projectId"></cnsl-project-grants>
</ng-container>
<ng-container *ngIf="currentSetting === 'grants'">
<ng-container *ngIf="currentSetting.id === 'grants'">
<h2 class="section-h2">{{ 'GRANTS.TITLE' | translate }}</h2>
<p class="desc cnsl-secondary-text">{{ 'GRANTS.DESC' | translate }}</p>
@@ -1,7 +1,6 @@
import { Location } from '@angular/common';
import { Component, EventEmitter, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatTableDataSource } from '@angular/material/table';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, from, Observable, of } from 'rxjs';
@@ -12,8 +11,7 @@ import { ProjectPrivateLabelingDialogComponent } from 'src/app/modules/project-p
import { SidenavSetting } from 'src/app/modules/sidenav/sidenav.component';
import { UserGrantContext } from 'src/app/modules/user-grants/user-grants-datasource';
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
import { App } from 'src/app/proto/generated/zitadel/app_pb';
import { ListAppsResponse, UpdateProjectRequest } from 'src/app/proto/generated/zitadel/management_pb';
import { UpdateProjectRequest } from 'src/app/proto/generated/zitadel/management_pb';
import { Member } from 'src/app/proto/generated/zitadel/member_pb';
import { PrivateLabelingSetting, Project, ProjectState } from 'src/app/proto/generated/zitadel/project_pb';
import { User } from 'src/app/proto/generated/zitadel/user_pb';
@@ -21,7 +19,7 @@ import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { NameDialogComponent } from '../../../../modules/name-dialog/name-dialog.component';
import { NameDialogComponent } from 'src/app/modules/name-dialog/name-dialog.component';
const ROUTEPARAM = 'projectid';
@@ -39,11 +37,6 @@ export class OwnedProjectDetailComponent implements OnInit {
public projectId: string = '';
public project?: Project.AsObject;
public pageSizeApps: number = 10;
public appsDataSource: MatTableDataSource<App.AsObject> = new MatTableDataSource<App.AsObject>();
public appsResult!: ListAppsResponse.AsObject;
public appsColumns: string[] = ['name'];
public ProjectState: any = ProjectState;
public ChangeType: any = ChangeType;
@@ -61,22 +54,25 @@ export class OwnedProjectDetailComponent implements OnInit {
public refreshChanges$: EventEmitter<void> = new EventEmitter();
public settingsList: SidenavSetting[] = [GENERAL, ROLES, PROJECTGRANTS, GRANTS];
public currentSetting: string = '';
public currentSetting = this.settingsList[0];
constructor(
public translate: TranslateService,
private route: ActivatedRoute,
private toast: ToastService,
private mgmtService: ManagementService,
private _location: Location,
private dialog: MatDialog,
private router: Router,
private breadcrumbService: BreadcrumbService,
) {
this.currentSetting = 'general';
route.queryParams.pipe(take(1)).subscribe((params: Params) => {
const { id } = params;
if (id) {
this.currentSetting = id;
route.queryParamMap.pipe(take(1)).subscribe((params) => {
const id = params.get('id');
if (!id) {
return;
}
const setting = this.settingsList.find((setting) => setting.id === id);
if (setting) {
this.currentSetting = setting;
}
});
}
@@ -85,7 +81,7 @@ export class OwnedProjectDetailComponent implements OnInit {
const projectId = this.route.snapshot.paramMap.get(ROUTEPARAM);
if (projectId) {
this.projectId = projectId;
this.getData(projectId);
this.getData(projectId).then();
}
}
@@ -249,7 +245,7 @@ export class OwnedProjectDetailComponent implements OnInit {
const params: Params = {
deferredReload: true,
};
this.router.navigate(['/projects'], { queryParams: params });
this.router.navigate(['/projects'], { queryParams: params }).then();
})
.catch((error) => {
this.toast.showError(error);
@@ -280,10 +276,6 @@ export class OwnedProjectDetailComponent implements OnInit {
}
}
public navigateBack(): void {
this._location.back();
}
public updateName(): void {
this.saveProject();
}
@@ -323,7 +315,7 @@ export class OwnedProjectDetailComponent implements OnInit {
public showDetail(): void {
if (this.project) {
this.router.navigate(['projects', this.project.id, 'members']);
this.router.navigate(['projects', this.project.id, 'members']).then();
}
}
}
@@ -5,7 +5,6 @@
[loading]="dataSource.loading$ | async"
*ngIf="projectId"
(refreshed)="refreshPage()"
[dataSize]="dataSource.totalResult"
[selection]="selection"
[timestamp]="dataSource.viewTimestamp"
(refreshed)="getRoleOptions(projectId)"
@@ -2,7 +2,6 @@
<cnsl-refresh-table
[hideRefresh]="true"
(refreshed)="refreshPage(type)"
[dataSize]="totalResult"
[timestamp]="viewTimestamp"
[selection]="selection"
[loading]="loading$ | async"
@@ -21,6 +21,11 @@
{{ 'USER.LOGINMETHODS.EMAIL.ISVERIFIED' | translate }}
</mat-checkbox>
</div>
<cnsl-form-field class="username">
<cnsl-label>{{ 'USER.PROFILE.USERNAME' | translate }}</cnsl-label>
<input class="stretchInput" cnslInput formControlName="username" required />
</cnsl-form-field>
<cnsl-form-field class="givenName">
<cnsl-label>{{ 'USER.PROFILE.FIRSTNAME' | translate }}</cnsl-label>
<input cnslInput formControlName="givenName" required />
@@ -29,14 +34,6 @@
<cnsl-label>{{ 'USER.PROFILE.LASTNAME' | translate }}</cnsl-label>
<input cnslInput formControlName="familyName" required />
</cnsl-form-field>
<cnsl-form-field class="nickName">
<cnsl-label>{{ 'USER.PROFILE.NICKNAME' | translate }}</cnsl-label>
<input cnslInput formControlName="nickName" />
</cnsl-form-field>
<cnsl-form-field class="username">
<cnsl-label>{{ 'USER.PROFILE.USERNAME' | translate }}</cnsl-label>
<input cnslInput formControlName="username" required />
</cnsl-form-field>
<div class="authenticationFactor">
<mat-radio-group
@@ -13,8 +13,8 @@
grid-template-areas:
'email email'
'emailVerified emailVerified'
'username username'
'givenName familyName'
'nickName username'
'authenticationFactor authenticationFactor';
column-gap: 1rem;
}
@@ -35,10 +35,6 @@
grid-area: familyName;
}
.nickName {
grid-area: nickName;
}
.username {
grid-area: username;
}
@@ -97,7 +97,6 @@ export class UserCreateV2Component implements OnInit {
username: new FormControl('', { nonNullable: true, validators: [requiredValidator, minLengthValidator(2)] }),
givenName: new FormControl('', { nonNullable: true, validators: [requiredValidator] }),
familyName: new FormControl('', { nonNullable: true, validators: [requiredValidator] }),
nickName: new FormControl('', { nonNullable: true }),
emailVerified: new FormControl(false, { nonNullable: true }),
authenticationFactor: new FormControl<AuthenticationFactor['factor']>(authenticationFactor, {
nonNullable: true,
@@ -188,7 +187,6 @@ export class UserCreateV2Component implements OnInit {
profile: {
givenName: userValues.givenName,
familyName: userValues.familyName,
nickName: userValues.nickName,
},
email: {
email: userValues.email,
@@ -11,12 +11,7 @@
>
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table
[hideRefresh]="true"
[loading]="loading$ | async"
(refreshed)="getPasswordless()"
[dataSize]="dataSource.data.length"
>
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" (refreshed)="getPasswordless()">
<button
actions
class="button"
@@ -24,13 +24,11 @@
<div class="max-width-container">
<cnsl-meta-layout *ngIf="user(userQuery) as user">
<cnsl-sidenav
*ngIf="currentSetting$ | async as currentSetting"
[ngModel]="currentSetting"
(ngModelChange)="goToSetting($event)"
[setting]="currentSetting$()"
(settingChange)="currentSetting$.set($event)"
[settingsList]="settingsList"
queryParam="id"
>
<ng-container *ngIf="currentSetting === 'general' && humanUser(userQuery) as humanUser">
<ng-container *ngIf="currentSetting$().id === 'general' && humanUser(userQuery) as humanUser">
<cnsl-card
*ngIf="humanUser.type.value.profile as profile"
class="app-card"
@@ -91,11 +89,11 @@
</ng-template>
</ng-container>
<ng-container *ngIf="currentSetting === 'idp'">
<ng-container *ngIf="currentSetting$().id === 'idp'">
<cnsl-external-idps [userId]="user.userId" [service]="grpcAuthService"></cnsl-external-idps>
</ng-container>
<ng-container *ngIf="currentSetting === 'security'">
<ng-container *ngIf="currentSetting$().id === 'security'">
<cnsl-card *ngIf="humanUser(userQuery) as humanUser" title="{{ 'USER.PASSWORD.TITLE' | translate }}">
<div class="contact-method-col">
<div class="contact-method-row">
@@ -127,7 +125,7 @@
></cnsl-auth-user-mfa>
</ng-container>
<ng-container *ngIf="currentSetting === 'grants'">
<ng-container *ngIf="currentSetting$().id === 'grants'">
<cnsl-card title="{{ 'GRANTS.USER.TITLE' | translate }}" description="{{ 'GRANTS.USER.DESCRIPTION' | translate }}">
<cnsl-user-grants
[userId]="user.userId"
@@ -149,7 +147,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'memberships'">
<ng-container *ngIf="currentSetting$().id === 'memberships'">
<cnsl-card
title="{{ 'USER.MEMBERSHIPS.TITLE' | translate }}"
description="{{ 'USER.MEMBERSHIPS.DESCRIPTION' | translate }}"
@@ -158,7 +156,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="currentSetting === 'metadata' && (metadata$ | async) as metadataQuery">
<ng-container *ngIf="currentSetting$().id === 'metadata' && (metadata$ | async) as metadataQuery">
<cnsl-metadata
*ngIf="metadataQuery.state !== 'error'"
[metadata]="metadataQuery.value"
@@ -1,11 +1,11 @@
import { MediaMatcher } from '@angular/cdk/layout';
import { Component, DestroyRef, EventEmitter, OnInit } from '@angular/core';
import { Component, DestroyRef, EventEmitter, OnInit, signal } from '@angular/core';
import { Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Buffer } from 'buffer';
import { defer, EMPTY, fromEvent, mergeWith, Observable, of, shareReplay, Subject, switchMap, take } from 'rxjs';
import { defer, EMPTY, mergeWith, Observable, of, shareReplay, Subject, switchMap, take } from 'rxjs';
import { ChangeType } from 'src/app/modules/changes/changes.component';
import { phoneValidator, requiredValidator } from 'src/app/modules/form-field/validators/validators';
import { InfoDialogComponent } from 'src/app/modules/info-dialog/info-dialog.component';
@@ -25,7 +25,7 @@ import { formatPhone } from 'src/app/utils/formatPhone';
import { EditDialogComponent, EditDialogData, EditDialogResult, EditDialogType } from './edit-dialog/edit-dialog.component';
import { LanguagesService } from 'src/app/services/languages.service';
import { Gender, HumanProfile, HumanUser, User, UserState } from '@zitadel/proto/zitadel/user/v2/user_pb';
import { catchError, filter, map, startWith, withLatestFrom } from 'rxjs/operators';
import { catchError, filter, map, startWith } from 'rxjs/operators';
import { pairwiseStartWith } from 'src/app/utils/pairwiseStartWith';
import { NewAuthService } from 'src/app/services/new-auth.service';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -75,7 +75,7 @@ export class AuthUserDetailComponent implements OnInit {
protected readonly user$: Observable<UserQuery>;
protected readonly metadata$: Observable<MetadataQuery>;
private readonly savedLanguage$: Observable<string>;
protected readonly currentSetting$: Observable<string | undefined>;
protected readonly currentSetting$ = signal<SidenavSetting>(this.settingsList[0]);
protected readonly loginPolicy$: Observable<LoginPolicy>;
protected readonly userName$: Observable<string>;
@@ -86,7 +86,6 @@ export class AuthUserDetailComponent implements OnInit {
private dialog: MatDialog,
private auth: AuthenticationService,
private breadcrumbService: BreadcrumbService,
private mediaMatcher: MediaMatcher,
public langSvc: LanguagesService,
private readonly route: ActivatedRoute,
private readonly newAuthService: NewAuthService,
@@ -95,7 +94,6 @@ export class AuthUserDetailComponent implements OnInit {
private readonly destroyRef: DestroyRef,
private readonly router: Router,
) {
this.currentSetting$ = this.getCurrentSetting$().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.user$ = this.getUser$().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.userName$ = this.getUserName(this.user$);
this.savedLanguage$ = this.getSavedLanguage$(this.user$);
@@ -150,6 +148,7 @@ export class AuthUserDetailComponent implements OnInit {
]);
}
});
this.user$.pipe(mergeWith(this.metadata$), takeUntilDestroyed(this.destroyRef)).subscribe((query) => {
if (query.state == 'error') {
this.toast.showError(query.error);
@@ -159,22 +158,16 @@ export class AuthUserDetailComponent implements OnInit {
this.savedLanguage$
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((savedLanguage) => this.translate.use(savedLanguage));
}
private getCurrentSetting$(): Observable<string | undefined> {
const mediaq: string = '(max-width: 500px)';
const matcher = this.mediaMatcher.matchMedia(mediaq);
const small$ = fromEvent(matcher, 'change', ({ matches }: MediaQueryListEvent) => matches).pipe(
startWith(matcher.matches),
);
return this.route.queryParamMap.pipe(
map((params) => params.get('id')),
filter(Boolean),
startWith('general'),
withLatestFrom(small$),
map(([id, small]) => (small ? undefined : id)),
);
const param = this.route.snapshot.queryParamMap.get('id');
if (!param) {
return;
}
const setting = this.settingsList.find(({ id }) => id === param);
if (!setting) {
return;
}
this.currentSetting$.set(setting);
}
private getUser$(): Observable<UserQuery> {
@@ -9,12 +9,7 @@
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table
[hideRefresh]="true"
[loading]="loading$ | async"
(refreshed)="getMFAs()"
[dataSize]="dataSource.data.length"
>
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" (refreshed)="getMFAs()">
<button
actions
class="button"
@@ -8,13 +8,7 @@
>
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table
[hideRefresh]="true"
[loading]="loading$ | async"
[dataSize]="dataSource.data.length"
[timestamp]="viewTimestamp"
[selection]="selection"
>
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" [timestamp]="viewTimestamp" [selection]="selection">
<div class="table-wrapper">
<table class="table" mat-table [dataSource]="dataSource">
<ng-container matColumnDef="select">
@@ -11,7 +11,7 @@
>
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" [dataSize]="dataSource.data.length">
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async">
<button
actions
[disabled]="disabled"
@@ -52,10 +52,9 @@
<cnsl-meta-layout>
<cnsl-sidenav
*ngIf="settingsList$ | async as settingsList"
[ngModel]="currentSetting$ | async"
(ngModelChange)="goToSetting($event)"
[setting]="currentSetting$()"
(settingChange)="currentSetting$.set($event)"
[settingsList]="settingsList"
queryParam="id"
>
<div class="max-width-container">
<cnsl-info-section class="locked" *ngIf="user?.state === UserState.LOCKED" [type]="InfoSectionType.WARN">
@@ -72,7 +71,7 @@
</cnsl-info-section>
</div>
<ng-container *ngIf="(currentSetting$ | async) === 'general'">
<ng-container *ngIf="currentSetting$().id === 'general'">
<ng-template
*ngIf="humanUser(user) as user"
cnslHasRole
@@ -141,13 +140,13 @@
</ng-container>
<cnsl-external-idps
*ngIf="(currentSetting$ | async) === 'idp' && user.type.case === 'human' && user.userId"
*ngIf="currentSetting$().id === 'idp' && user.type.case === 'human' && user.userId"
[userId]="user.userId"
[service]="mgmtService"
/>
<cnsl-card
*ngIf="(currentSetting$ | async) === 'general' && user.type.case === 'machine'"
*ngIf="currentSetting$().id === 'general' && user.type.case === 'machine'"
title="{{ 'USER.MACHINE.TITLE' | translate }}"
>
<cnsl-detail-form-machine
@@ -158,7 +157,7 @@
/>
</cnsl-card>
<ng-container *ngIf="(currentSetting$ | async) === 'pat'">
<ng-container *ngIf="currentSetting$().id === 'pat'">
<ng-template cnslHasRole [hasRole]="['user.read$', 'user.read:' + user.userId]">
<cnsl-card
*ngIf="user.type.case === 'machine' && user.userId"
@@ -170,7 +169,7 @@
</ng-template>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'keys'">
<ng-container *ngIf="currentSetting$().id === 'keys'">
<ng-template cnslHasRole [hasRole]="['user.read$', 'user.read:' + user.userId]">
<cnsl-card
*ngIf="user.type.case === 'machine' && user.userId"
@@ -182,7 +181,7 @@
</ng-template>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'security'">
<ng-container *ngIf="currentSetting$().id === 'security'">
<cnsl-card *ngIf="user.type.case === 'human'" title="{{ 'USER.PASSWORD.TITLE' | translate }}">
<div class="contact-method-col">
<div class="contact-method-row">
@@ -214,7 +213,7 @@
<cnsl-user-mfa *ngIf="user.type.case === 'human'" [user]="user"></cnsl-user-mfa>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'grants'">
<ng-container *ngIf="currentSetting$().id === 'grants'">
<cnsl-card
*ngIf="user.userId"
title="{{ 'GRANTS.USER.TITLE' | translate }}"
@@ -239,7 +238,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'memberships'">
<ng-container *ngIf="currentSetting$().id === 'memberships'">
<cnsl-card
*ngIf="user.userId"
title="{{ 'USER.MEMBERSHIPS.TITLE' | translate }}"
@@ -249,7 +248,7 @@
</cnsl-card>
</ng-container>
<ng-container *ngIf="(currentSetting$ | async) === 'metadata' && (metadata$ | async) as metadataQuery">
<ng-container *ngIf="currentSetting$().id === 'metadata' && (metadata$ | async) as metadataQuery">
<cnsl-metadata
*ngIf="user.userId && metadataQuery.state !== 'error'"
[metadata]="metadataQuery.value"
@@ -1,12 +1,11 @@
import { MediaMatcher } from '@angular/cdk/layout';
import { Location } from '@angular/common';
import { Component, DestroyRef, EventEmitter, OnInit } from '@angular/core';
import { Component, DestroyRef, EventEmitter, OnInit, signal } from '@angular/core';
import { Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Buffer } from 'buffer';
import { catchError, filter, map, startWith, tap, withLatestFrom } from 'rxjs/operators';
import { catchError, filter, map, startWith, take } from 'rxjs/operators';
import { ChangeType } from 'src/app/modules/changes/changes.component';
import { phoneValidator, requiredValidator } from 'src/app/modules/form-field/validators/validators';
import { InfoSectionType } from 'src/app/modules/info-section/info-section.component';
@@ -39,7 +38,7 @@ import {
combineLatestWith,
defer,
EMPTY,
fromEvent,
identity,
mergeWith,
Observable,
ObservedValueOf,
@@ -79,6 +78,7 @@ type MetadataQuery =
type UserWithHumanType = Omit<UserV2, 'type'> & { type: { case: 'human'; value: HumanUser } };
// todo: figure out why media matcher is needed
@Component({
selector: 'cnsl-user-detail',
templateUrl: './user-detail.component.html',
@@ -98,7 +98,7 @@ export class UserDetailComponent implements OnInit {
public refreshChanges$: EventEmitter<void> = new EventEmitter();
public InfoSectionType: any = InfoSectionType;
public currentSetting$: Observable<string | undefined>;
public currentSetting$ = signal<SidenavSetting>(GENERAL);
public settingsList$: Observable<SidenavSetting[]>;
public metadata$: Observable<MetadataQuery>;
public loginPolicy$: Observable<LoginPolicy>;
@@ -111,7 +111,6 @@ export class UserDetailComponent implements OnInit {
private _location: Location,
private dialog: MatDialog,
private router: Router,
private mediaMatcher: MediaMatcher,
public langSvc: LanguagesService,
private readonly userService: UserService,
private readonly newMgmtService: NewMgmtService,
@@ -126,9 +125,8 @@ export class UserDetailComponent implements OnInit {
}),
]);
this.currentSetting$ = this.getCurrentSetting$().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.user$ = this.getUser$().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.settingsList$ = this.getSettingsList$(this.user$);
this.settingsList$ = this.getSettingsList$(this.user$).pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.metadata$ = this.getMetadata$(this.user$).pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.loginPolicy$ = defer(() => this.newMgmtService.getLoginPolicy()).pipe(
@@ -177,31 +175,6 @@ export class UserDetailComponent implements OnInit {
);
}
private getCurrentSetting$(): Observable<string | undefined> {
const mediaq: string = '(max-width: 500px)';
const matcher = this.mediaMatcher.matchMedia(mediaq);
const small$ = fromEvent(matcher, 'change', ({ matches }: MediaQueryListEvent) => matches).pipe(
startWith(matcher.matches),
);
return this.route.queryParamMap.pipe(
map((params) => params.get('id')),
filter(Boolean),
startWith('general'),
withLatestFrom(small$),
map(([id, small]) => (small ? undefined : id)),
);
}
public async goToSetting(setting: string) {
await this.router.navigate([], {
relativeTo: this.route,
queryParams: { id: setting },
queryParamsHandling: 'merge',
skipLocationChange: true,
});
}
private getUserById(userId: string): Observable<UserQuery> {
return defer(() => this.userService.getUserById(userId)).pipe(
map(({ user }) => {
@@ -244,6 +217,20 @@ export class UserDetailComponent implements OnInit {
this.toast.showError(query.value);
}
});
const param = this.route.snapshot.queryParamMap.get('id');
if (!param) {
return;
}
this.settingsList$
.pipe(
takeUntilDestroyed(this.destroyRef),
map((settings) => settings.find(({ id }) => id === param)),
filter(Boolean),
take(1),
)
.subscribe((setting) => this.currentSetting$.set(setting));
}
public changeUsername(user: UserV2): void {
@@ -12,12 +12,7 @@
>
<mat-icon class="icon">refresh</mat-icon>
</button>
<cnsl-refresh-table
[hideRefresh]="true"
[loading]="mfaQuery.state === 'loading'"
(refreshed)="refresh$.next(true)"
[dataSize]="mfaQuery.value.data.length"
>
<cnsl-refresh-table [hideRefresh]="true" [loading]="mfaQuery.state === 'loading'" (refreshed)="refresh$.next(true)">
<table class="table" mat-table [dataSource]="mfaQuery.value">
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef>{{ 'USER.MFA.TABLETYPE' | translate }}</th>
@@ -2,7 +2,6 @@
*ngIf="type$ | async as type"
[loading]="loading()"
(refreshed)="this.refresh$.next(true)"
[dataSize]="dataSize()"
[hideRefresh]="true"
[timestamp]="(users$ | async)?.details?.timestamp"
[selection]="selection"