feat: UserService zur Filterung von importierten Benuzer in DirUserTableComponent hinzugefügt

This commit is contained in:
Developer 02 2024-07-25 02:03:38 +02:00
parent 5a7eb504a9
commit 1b2e3b8abd
2 changed files with 10 additions and 4 deletions

View File

@ -26,7 +26,7 @@ export class DirGroupTableComponent extends BaseTableComponent<DirGroup, DirGrou
this.service.getAll().subscribe({
next: async (response) => {
const group_names = (await firstValueFrom(this.gService.getAll())).map(g => g.name);
this.source = response.filter(dGroup => dGroup.samaccountname.length && group_names.includes(dGroup.samaccountname[0]));
this.source = response.filter(dGroup => dGroup.samaccountname?.length && !group_names.includes(dGroup.samaccountname[0]));
this.loading = false;
},
error: (error) => { }

View File

@ -7,6 +7,8 @@ import { ColorModeService } from '../../../services/color-mode.service';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { env } from '../../../../environments/environment';
import { UserService } from '../../../services/user.service';
import { firstValueFrom } from 'rxjs/internal/firstValueFrom';
@Component({
standalone: true,
@ -16,14 +18,18 @@ import { env } from '../../../../environments/environment';
styleUrl: './dir-user-table.component.css'
})
export class DirUserTableComponent extends BaseTableComponent<DirUser, DirUserService> {
constructor(service: DirUserService, cModeService: ColorModeService) {
constructor(service: DirUserService, cModeService: ColorModeService, private uService: UserService) {
super(service, env.columnNames.dirUser, cModeService)
}
fetchDataByGroupName(groupName: string): void {
this.service.getAll(groupName).subscribe({
next: (response: any) => {
this.source = response;
next: async (response: DirUser[]) => {
const usernames = (await firstValueFrom(this.uService.getAll())).map(u => u.username)
console.log(usernames)
console.log(response)
this.source = response.filter(user => user.samaccountname?.length && !usernames.includes(user.samaccountname[0]));
this.loading = false;
},
error: (error: any) => { }