mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-28 15:08:51 +00:00
# Which Problems Are Solved The management console deletes all roles if user grant is not manipulated before saving in the dialog. # How the Problems Are Solved Correctly prefill the selected role assignments so when no change was done we keep the current state. # Additional Changes - Prevents displaying misleading error messages to users when a role assignment operation results in no actual changes. # Additional Context - Closes #10517 Co-authored-by: Max Peintner <[email protected]>
This commit is contained in:
+16
-18
@@ -1,6 +1,15 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { Component, inject, Inject, signal } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
|
||||
export type UserGrantRoleDialogData = {
|
||||
projectId: string;
|
||||
grantId?: string;
|
||||
selectedRoleKeysList: string[];
|
||||
i18nTitle: string;
|
||||
};
|
||||
|
||||
export type UserGrantRoleDialogResult = { roles: string[] };
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-user-grant-role-dialog',
|
||||
templateUrl: './user-grant-role-dialog.component.html',
|
||||
@@ -8,30 +17,19 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
standalone: false,
|
||||
})
|
||||
export class UserGrantRoleDialogComponent {
|
||||
public projectId: string = '';
|
||||
public grantId: string = '';
|
||||
public selectedRoleKeysList: string[] = [];
|
||||
|
||||
public selectedRoleKeys: string[] = [];
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<UserGrantRoleDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) {
|
||||
this.projectId = data.projectId;
|
||||
this.grantId = data.grantId;
|
||||
this.selectedRoleKeysList = data.selectedRoleKeysList;
|
||||
}
|
||||
protected readonly data: UserGrantRoleDialogData = inject(MAT_DIALOG_DATA);
|
||||
private readonly dialogRef: MatDialogRef<UserGrantRoleDialogComponent, UserGrantRoleDialogResult> = inject(MatDialogRef);
|
||||
private readonly selectedRoleKeys = signal([...this.data.selectedRoleKeysList]);
|
||||
|
||||
public selectRoles(selected: string[]): void {
|
||||
this.selectedRoleKeys = selected;
|
||||
this.selectedRoleKeys.set(selected);
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public closeDialogWithSuccess(): void {
|
||||
this.dialogRef.close({ roles: this.selectedRoleKeys });
|
||||
this.dialogRef.close({ roles: this.selectedRoleKeys() });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user