mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-06 14:22:15 +00:00
feat: allow global org users to create org and self delete (#2759)
* fix: grant PROJECT_OWNER_VIEWER_GLOBAL org.create permission * Update authz.yaml * feat: delete my user * console things * lint * signout after deletion * stylelint rule * Update authz.yaml * Update authz.yaml * setup step * role SELF_MANAGEMENT_GLOBAL setup * fix: change default role on global org * Apply suggestions from code review Co-authored-by: Fabi <[email protected]> * Update console/src/assets/i18n/it.json Co-authored-by: Fabi <[email protected]> Co-authored-by: Max Peintner <[email protected]> Co-authored-by: Fabi <[email protected]>
This commit is contained in:
co-authored by
Fabi
Max Peintner
parent
7ea93bd5b6
commit
43f15953c3
+11
@@ -55,6 +55,17 @@
|
||||
<ng-template cnslHasFeature [hasFeature]="['metadata.user']">
|
||||
<cnsl-metadata *ngIf="user?.id" [userId]="user.id"></cnsl-metadata>
|
||||
</ng-template>
|
||||
|
||||
<ng-template cnslHasRole [hasRole]="['user.self.delete']">
|
||||
<cnsl-card title="{{'USER.PAGES.DELETEACCOUNT'| translate}}" [warn]="true">
|
||||
<p>{{'USER.PAGES.DELETEACCOUNT_DESC'| translate}}</p>
|
||||
|
||||
<div class="delete-account-wrapper">
|
||||
<button color="warn" mat-raised-button (click)="deleteAccount()">{{'USER.PAGES.DELETEACCOUNT_BTN' |
|
||||
translate}}</button>
|
||||
</div>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
<div *ngIf="user" class="side" metainfo>
|
||||
|
||||
+5
@@ -60,3 +60,8 @@
|
||||
.side-padding {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.delete-account-wrapper {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
+29
@@ -4,7 +4,9 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { ChangeType } from 'src/app/modules/changes/changes.component';
|
||||
import { UserGrantContext } from 'src/app/modules/user-grants/user-grants-datasource';
|
||||
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
||||
import { Email, Gender, Phone, Profile, User, UserState } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
import { AuthenticationService } from 'src/app/services/authentication.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@@ -36,6 +38,7 @@ export class AuthUserDetailComponent implements OnDestroy {
|
||||
private toast: ToastService,
|
||||
public userService: GrpcAuthService,
|
||||
private dialog: MatDialog,
|
||||
private auth: AuthenticationService,
|
||||
) {
|
||||
this.loading = true;
|
||||
this.refreshUser();
|
||||
@@ -252,4 +255,30 @@ export class AuthUserDetailComponent implements OnDestroy {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public deleteAccount(): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'USER.DIALOG.DELETE_BTN',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'USER.DIALOG.DELETE_TITLE',
|
||||
descriptionKey: 'USER.DIALOG.DELETE_AUTH_DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((resp) => {
|
||||
if (resp) {
|
||||
this.userService
|
||||
.RemoveMyUser()
|
||||
.then(() => {
|
||||
this.toast.showInfo('USER.PAGES.DELETEACCOUNT_SUCCESS', true);
|
||||
this.auth.signout();
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user