Integration des Active Directory Controllers und Active Directory Service abgeschlossen.

This commit is contained in:
Developer 02
2024-03-11 08:48:40 +01:00
parent 58f87e2be5
commit df9bc33795
420 changed files with 2611 additions and 4118 deletions

View File

@@ -1,10 +0,0 @@
<nav class="navbar bg-body-tertiary">
<form class="container-fluid justify-content-start">
<button class="btn btn-outline-success me-2" type="button" (click)="addSelectedGroups()">Hinzufügen</button>
</form>
</nav>
<gui-grid #grid [columns]="columns" [columnMenu]="columnMenu" [sorting]="sorting" [loading]="loading"
[rowSelection]="rowSelection" [rowDetail]="rowDetail" [autoResizeWidth]="autoResizeWidth" [paging]="paging"
[searching]="searching" [cellEditing]="cellEditing" [virtualScroll]="true" [infoPanel]="infoPanel"
[titlePanel]="titlePanel" [theme]="theme" (selectedRows)="onSelectedRows($event)">
</gui-grid>

View File

@@ -1,7 +1,6 @@
import { AfterViewInit, Component, Inject, Input, OnInit, ViewChild, input } from '@angular/core';
import { ApiService } from '../../../services/user-management.api.service';
import { GuiColumn, GuiColumnMenu, GuiSorting, GuiRowDetail, GuiPaging, GuiPagingDisplay, GuiSearching, GuiCellEdit, GuiInfoPanel, GuiTitlePanel, GuiRowSelection, GuiSelectedRow, GuiGridComponent, GuiGridApi, GuiTheme } from '@generic-ui/ngx-grid';
import { GuiCellView } from '@generic-ui/ngx-grid';
@Component({
selector: 'app-base-table',

View File

@@ -1,23 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AdGroupUserTableComponent } from './ad-group-user-table.component';
describe('AdGroupUserTableComponent', () => {
let component: AdGroupUserTableComponent;
let fixture: ComponentFixture<AdGroupUserTableComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AdGroupUserTableComponent]
})
.compileComponents();
fixture = TestBed.createComponent(AdGroupUserTableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DirGroupTableComponent } from './dir-group-table.component';
describe('AdGroupUserTableComponent', () => {
let component: DirGroupTableComponent;
let fixture: ComponentFixture<DirGroupTableComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [DirGroupTableComponent]
})
.compileComponents();
fixture = TestBed.createComponent(DirGroupTableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,17 @@
import { Component, Inject } from '@angular/core';
import { BaseTableComponent } from '../base-table/base-table.component';
import { DirGroupService } from 'src/app/services/dir-group.service';
import { DirGroup } from 'src/app/models/user-management.api.models';
import { GuiColumn } from '@generic-ui/ngx-grid';
import { GroupService } from 'src/app/services/group.service';
@Component({
selector: 'app-dir-group-table',
templateUrl: '../base-table/base-table.component.html',
styleUrl: './dir-group-table.component.css'
})
export class DirGroupTableComponent extends BaseTableComponent<DirGroup, DirGroupService> {
constructor(service: DirGroupService, @Inject('DIR_GROUP_TABLE_COLUMNS') columns: Array<GuiColumn>) {
super(service, columns)
}
}

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DirUserTableComponent } from './dir-user-table.component';
describe('DirUserTableComponent', () => {
let component: DirUserTableComponent;
let fixture: ComponentFixture<DirUserTableComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [DirUserTableComponent]
})
.compileComponents();
fixture = TestBed.createComponent(DirUserTableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,16 @@
import { Component, Inject } from '@angular/core';
import { DirUser } from 'src/app/models/user-management.api.models';
import { DirUserService } from 'src/app/services/dir-user.service';
import { BaseTableComponent } from '../base-table/base-table.component';
import { GuiColumn } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
@Component({
selector: 'app-dir-user-table',
templateUrl: '../base-table/base-table.component.html',
styleUrl: './dir-user-table.component.css'
})
export class DirUserTableComponent extends BaseTableComponent<DirUser, DirUserService> {
constructor(service: DirUserService, @Inject('DIR_USER_TABLE_COLUMNS') columns: Array<GuiColumn>) {
super(service, columns)
}
}

View File

@@ -0,0 +1,13 @@
<nav class="navbar bg-body-tertiary">
<form class="container-fluid justify-content-start">
<button class="btn btn-outline-success me-2" type="button" (click)="addSelectedGroups()">Hinzufügen</button>
</form>
</nav>
<div class="row">
<div class="col-6">
<app-dir-group-table #dirGroups [rowSelection]="dirGroupsRowSelection"></app-dir-group-table>
</div>
<div class="col-6">
<app-dir-user-table #dirUsers [initData]="initWithoutData"></app-dir-user-table>
</div>
</div>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserGroupDirImportComponent } from './user-group-dir-import.component';
describe('UserGroupDirImportComponent', () => {
let component: UserGroupDirImportComponent;
let fixture: ComponentFixture<UserGroupDirImportComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [UserGroupDirImportComponent]
})
.compileComponents();
fixture = TestBed.createComponent(UserGroupDirImportComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,72 +1,85 @@
import { Component, Inject } from '@angular/core';
import { BaseTableComponent } from '../base-table/base-table.component';
import { ADGroupService } from 'src/app/services/ad-group.service';
import { ADGroup } from 'src/app/models/user-management.api.models';
import { GuiColumn, GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType, GuiSelectedRow } from '@generic-ui/ngx-grid';
import Swal from 'sweetalert2';
import { GroupService } from 'src/app/services/group.service';
import { forkJoin, of } from 'rxjs';
import { catchError, finalize } from 'rxjs/operators';
@Component({
selector: 'app-ad-group-user-table',
templateUrl: 'ad-group-user-table.component.html',
styleUrl: './ad-group-user-table.component.css'
})
export class AdGroupUserTableComponent extends BaseTableComponent<ADGroup, ADGroupService> {
constructor(
service: ADGroupService, public gService: GroupService, @Inject('ADGROUP_COMPLETE_TABLE_COLUMNS') columns: Array<GuiColumn>) {
super(service, columns)
}
rowSelection: GuiRowSelection = {
enabled: true,
type: GuiRowSelectionType.CHECKBOX,
mode: GuiRowSelectionMode.MULTIPLE
}
addSelectedGroups() {
let requests = [];
let numAdded: number = 0;
for (let row of this.selectedRows) {
// Create an Observable for each request and add it to the requests array
requests.push(
this.gService.createByAd({ samAccountName: row?.source?.samAccountName }).pipe(
catchError((err) => {
console.log(err);
// In case of error, return a 'null' observable for this request, so it doesn't affect other requests
return of(null);
})
)
);
}
forkJoin(requests).pipe(
// finalize is executed after all requests are completed or when an error occurs
finalize(() => {
// Show Swal notification after all requests are completed
Swal.fire({
icon: "success",
title: "Completed",
text: `${numAdded} new groups added`,
position: "center",
showConfirmButton: false,
timer: 3000
});
this.safelyUnselectAll();
})
).subscribe({
next: (results) => {
// Increment numAdded for each successful request
// You can increment numAdded for each result that is not null
numAdded += results.filter(result => result !== null).length;
},
error: (err) => {
// You may need to handle any potential errors here
console.log('An error occurred', err);
}
});
}
}
import { AfterViewInit, Component, Inject, OnInit, ViewChild } from '@angular/core';
import { GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType } from '@generic-ui/ngx-grid';
import Swal from 'sweetalert2';
import { GroupService } from 'src/app/services/group.service';
import { forkJoin, of } from 'rxjs';
import { catchError, finalize } from 'rxjs/operators';
import { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';
import { DirUserTableComponent } from '../tables/dir-user-table/dir-user-table.component';
@Component({
selector: 'app-user-group-dir-import',
templateUrl: './user-group-dir-import.component.html',
styleUrl: './user-group-dir-import.component.css'
})
export class UserGroupDirImportComponent implements OnInit, AfterViewInit {
initWithoutData = () => {}
constructor(public gService: GroupService) {
}
ngOnInit(): void {
}
ngAfterViewInit(): void {
this.dirUsers.loading = false;
}
@ViewChild('dirGroups') dirGroups! : DirGroupTableComponent;
@ViewChild('dirUsers') dirUsers! : DirUserTableComponent;
dirGroupsRowSelection: GuiRowSelection = {
enabled: true,
type: GuiRowSelectionType.CHECKBOX,
mode: GuiRowSelectionMode.MULTIPLE
}
addSelectedGroups() {
let requests = [];
let numAdded: number = 0;
for (let row of this.dirGroups.selectedRows) {
console.log(row)
console.log({ samaccountname: row?.source?.samaccountname })
// Create an Observable for each request and add it to the requests array
requests.push(
this.gService.createByAd({ samaccountname: row?.source?.samaccountname }).pipe(
catchError((err) => {
console.log(err);
// In case of error, return a 'null' observable for this request, so it doesn't affect other requests
return of(null);
})
)
);
}
forkJoin(requests).pipe(
// finalize is executed after all requests are completed or when an error occurs
finalize(() => {
// Show Swal notification after all requests are completed
Swal.fire({
icon: "success",
title: "Completed",
text: `${numAdded} new groups added`,
position: "center",
showConfirmButton: false,
timer: 3000
});
this.dirGroups.safelyUnselectAll();
})
).subscribe({
next: (results) => {
// Increment numAdded for each successful request
// You can increment numAdded for each result that is not null
numAdded += results.filter(result => result !== null).length;
},
error: (err) => {
// You may need to handle any potential errors here
console.log('An error occurred', err);
}
});
}
}