implement user, role, product, and task management components along with associated services and UI updates
This commit is contained in:
@@ -13,6 +13,7 @@ import { Router, ActivatedRoute, RouterLink } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/** Custom Service Zitadel */
|
||||
@@ -36,6 +37,7 @@ export class AddRoleComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private authService = inject(AuthService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Role form. */
|
||||
roleForm: UntypedFormGroup;
|
||||
@@ -69,7 +71,12 @@ export class AddRoleComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
this.systemService.createRole(this.roleForm.value).subscribe((response: any) => {
|
||||
if (environment.OIDC.oidcServerEnabled) {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Role creation request submitted successfully for approval.'
|
||||
});
|
||||
} else if (environment.OIDC.oidcServerEnabled) {
|
||||
this.authService.createRole(response.resourceId, this.roleForm.value.name, this.roleForm.value.description);
|
||||
}
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/** Custom Service Zitadel */
|
||||
@@ -36,6 +37,7 @@ export class EditRoleComponent implements OnInit {
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private authService = inject(AuthService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Role Form */
|
||||
roleForm: UntypedFormGroup;
|
||||
@@ -83,8 +85,13 @@ export class EditRoleComponent implements OnInit {
|
||||
* if successful redirects to view updated roles and permissions.
|
||||
*/
|
||||
submit() {
|
||||
this.systemService.updateRole(this.roleForm.value, this.roleData.id).subscribe(() => {
|
||||
if (environment.OIDC.oidcServerEnabled) {
|
||||
this.systemService.updateRole(this.roleForm.value, this.roleData.id).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Role update request submitted successfully for approval.'
|
||||
});
|
||||
} else if (environment.OIDC.oidcServerEnabled) {
|
||||
this.authService.updateRole(
|
||||
this.roleData.id,
|
||||
this.roleForm.get('name')?.value,
|
||||
|
||||
@@ -22,6 +22,7 @@ import { EnableDialogComponent } from '../../../shared/enable-dialog/enable-dial
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/** Custom Service Zitadel */
|
||||
import { environment } from '../../../../environments/environment';
|
||||
@@ -48,6 +49,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
private translateService = inject(TranslateService);
|
||||
dialog = inject(MatDialog);
|
||||
private authService = inject(AuthService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Role Permissions Data */
|
||||
rolePermissionService: any;
|
||||
@@ -720,7 +722,14 @@ export class ViewRoleComponent implements OnInit {
|
||||
this.formGroup.controls.roster.disable();
|
||||
this.checkboxesChanged = false;
|
||||
this.isDisabled = true;
|
||||
this.systemService.updateRolePermission(this.roleId, permissionData).subscribe((response: any) => {});
|
||||
this.systemService.updateRolePermission(this.roleId, permissionData).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Role permissions update request submitted successfully for approval.'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -756,8 +765,13 @@ export class ViewRoleComponent implements OnInit {
|
||||
});
|
||||
deleteRoleDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteRole(this.roleId).subscribe(() => {
|
||||
if (environment.OIDC.oidcServerEnabled) {
|
||||
this.systemService.deleteRole(this.roleId).subscribe((res: any) => {
|
||||
if (res?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Role deletion request submitted successfully for approval.'
|
||||
});
|
||||
} else if (environment.OIDC.oidcServerEnabled) {
|
||||
this.authService.deleteRole(this.roleId);
|
||||
}
|
||||
this.router.navigate(['/system/roles-and-permissions']);
|
||||
@@ -776,7 +790,13 @@ export class ViewRoleComponent implements OnInit {
|
||||
});
|
||||
enableRoleDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.enable) {
|
||||
this.systemService.enableRole(this.roleId).subscribe(() => {
|
||||
this.systemService.enableRole(this.roleId).subscribe((res: any) => {
|
||||
if (res?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Role enablement request submitted successfully for approval.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['/system/roles-and-permissions']);
|
||||
});
|
||||
} else {
|
||||
@@ -793,7 +813,13 @@ export class ViewRoleComponent implements OnInit {
|
||||
});
|
||||
deleteRoleDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.disable) {
|
||||
this.systemService.disableRole(this.roleId).subscribe(() => {
|
||||
this.systemService.disableRole(this.roleId).subscribe((res: any) => {
|
||||
if (res?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Role disablement request submitted successfully for approval.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['/system/roles-and-permissions']);
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user