Compare commits
13 Commits
d3c7ab3da3
...
d6b08c3c30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6b08c3c30 | ||
|
|
a5002a3038 | ||
|
|
a2077c58ca | ||
|
|
36d763d5e5 | ||
|
|
4746d63aea | ||
|
|
491c7b6514 | ||
|
|
2c9a81c90a | ||
|
|
153f818d12 | ||
|
|
c8ca3abebe | ||
|
|
3f7a60f04d | ||
|
|
2423263413 | ||
|
|
3c7f81987c | ||
|
|
f031b131eb |
@@ -31,13 +31,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div [ngClass]="checkBoxBSClass(3)">
|
<div [ngClass]="checkBoxBSClass(3)">
|
||||||
<mat-checkbox [formControl]="adSync">Ad Sync</mat-checkbox>
|
<mat-checkbox [disabled]="true">AD Sync</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div [ngClass]="checkBoxBSClass(3)">
|
<div [ngClass]="checkBoxBSClass(3)">
|
||||||
<mat-checkbox [formControl]="internal">Internal</mat-checkbox>
|
<mat-checkbox [(ngModel)]="checked" [disabled]="true">Internal</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div [ngClass]="checkBoxBSClass(2)">
|
<div [ngClass]="checkBoxBSClass(2)">
|
||||||
<mat-checkbox [formControl]="active">Active</mat-checkbox>
|
<mat-checkbox [formControl]="active" [disabled]="true">Active</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<div class="col d-flex justify-content-center me-4 my-2">
|
<div class="col d-flex justify-content-center me-4 my-2">
|
||||||
<button mat-fab extended (click)="delete()">
|
<button mat-fab extended (click)="delete()">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, signal } from '@angular/core';
|
import { Component, model, signal } from '@angular/core';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
@@ -26,8 +26,6 @@ import Swal from 'sweetalert2';
|
|||||||
export class GroupFormComponent {
|
export class GroupFormComponent {
|
||||||
readonly groupname = new FormControl('', [Validators.required]);
|
readonly groupname = new FormControl('', [Validators.required]);
|
||||||
readonly ecmFkId = new FormControl<number>(1, [Validators.required]);
|
readonly ecmFkId = new FormControl<number>(1, [Validators.required]);
|
||||||
readonly adSync = new FormControl<boolean>(false);
|
|
||||||
readonly internal = new FormControl<boolean>(true);
|
|
||||||
readonly active = new FormControl<boolean>(true);
|
readonly active = new FormControl<boolean>(true);
|
||||||
|
|
||||||
errorMessage = signal('');
|
errorMessage = signal('');
|
||||||
@@ -36,6 +34,8 @@ export class GroupFormComponent {
|
|||||||
public readonly buttonBSClass: string = "d-flex justify-content-center mx-1 my-2"
|
public readonly buttonBSClass: string = "d-flex justify-content-center mx-1 my-2"
|
||||||
public readonly checkBoxBSClass: (colCount: number | undefined) => string = (colCount: number = 2) => `col-${colCount} d-flex justify-content-left mx-1 my-2`
|
public readonly checkBoxBSClass: (colCount: number | undefined) => string = (colCount: number = 2) => `col-${colCount} d-flex justify-content-left mx-1 my-2`
|
||||||
|
|
||||||
|
readonly checked = model(true);
|
||||||
|
|
||||||
constructor(private uService: UserService, private rService: RefreshService, private gService: GroupService) {
|
constructor(private uService: UserService, private rService: RefreshService, private gService: GroupService) {
|
||||||
merge(
|
merge(
|
||||||
this.groupname.statusChanges, this.groupname.valueChanges,
|
this.groupname.statusChanges, this.groupname.valueChanges,
|
||||||
@@ -44,7 +44,6 @@ export class GroupFormComponent {
|
|||||||
.subscribe(() => this.updateErrorMessage());
|
.subscribe(() => this.updateErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updateErrorMessage() {
|
updateErrorMessage() {
|
||||||
if (this.groupname.hasError('required')) {
|
if (this.groupname.hasError('required')) {
|
||||||
this.errorMessage.set('Wert eingeben');
|
this.errorMessage.set('Wert eingeben');
|
||||||
@@ -58,8 +57,8 @@ export class GroupFormComponent {
|
|||||||
this.gService.create({
|
this.gService.create({
|
||||||
name: this.groupname.value!,
|
name: this.groupname.value!,
|
||||||
ecmFkId: (this.ecmFkId.value!),
|
ecmFkId: (this.ecmFkId.value!),
|
||||||
adSync: this.adSync.value!,
|
adSync: false,
|
||||||
internal: this.internal.value!,
|
internal: true,
|
||||||
active: this.active.value!
|
active: this.active.value!
|
||||||
}).subscribe({
|
}).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
@@ -78,8 +77,6 @@ export class GroupFormComponent {
|
|||||||
delete() {
|
delete() {
|
||||||
this.groupname.setValue('')
|
this.groupname.setValue('')
|
||||||
this.ecmFkId.setValue(1)
|
this.ecmFkId.setValue(1)
|
||||||
this.adSync.setValue(false)
|
|
||||||
this.internal.setValue(true)
|
|
||||||
this.active.setValue(true)
|
this.active.setValue(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,22 +30,22 @@
|
|||||||
<!-- Right menu -->
|
<!-- Right menu -->
|
||||||
<div class="navbar-collapse justify-content-end me-5">
|
<div class="navbar-collapse justify-content-end me-5">
|
||||||
<a class="navbar-brand" [routerLink]="['/']">User Manager Portal</a>
|
<a class="navbar-brand" [routerLink]="['/']">User Manager Portal</a>
|
||||||
<button *ngIf="isLogedIn()" class="btn" (click)="this.updateService.toggleEditability()" [ngStyle]="{ 'visibility': updateService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + L" matTooltipPosition="below" [matTooltipClass]="tooltipClass" [matTooltipDisabled]="!updateService.isVisible">
|
<button *ngIf="isLogedIn()" class="btn" (click)="creationService.openDialog()" [ngStyle]="{ 'visibility': creationService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + C" matTooltipPosition="below" matTooltipClass="pt-3" [matTooltipDisabled]="!creationService.isVisible">
|
||||||
<mat-icon class="scale-pulse">{{ updateService.isEditable ? 'lock_open' : 'lock' }}</mat-icon>
|
|
||||||
</button>
|
|
||||||
<button *ngIf="isLogedIn()" class="btn" (click)="updateService.executeAll()" [ngStyle]="{ 'visibility': updateService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + S" matTooltipPosition="below" [matTooltipClass]="tooltipClass" [matTooltipDisabled]="!updateService.isVisible">
|
|
||||||
<mat-icon class="scale-pulse" [matBadge]="updateActCount === 0 ? '' : updateActCount">save</mat-icon>
|
|
||||||
</button>
|
|
||||||
<button *ngIf="isLogedIn()" class="btn" (click)="creationService.openDialog()" [ngStyle]="{ 'visibility': creationService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + C" matTooltipPosition="below" [matTooltipClass]="tooltipClass" [matTooltipDisabled]="!creationService.isVisible">
|
|
||||||
<mat-icon class="scale-pulse">add_to_photos</mat-icon>
|
<mat-icon class="scale-pulse">add_to_photos</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="isLogedIn()" class="btn" (click)="transferService.executeAll()" [ngStyle]="{ 'visibility': transferService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + ␣" matTooltipPosition="below" [matTooltipClass]="tooltipClass" [matTooltipDisabled]="!transferService.isVisible">
|
<button *ngIf="isLogedIn()" class="btn" (click)="this.updateService.toggleEditability()" [ngStyle]="{ 'visibility': updateService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + L" matTooltipPosition="below" [matTooltipDisabled]="!updateService.isVisible">
|
||||||
|
<mat-icon class="scale-pulse">{{ updateService.isEditable ? 'lock_open' : 'lock' }}</mat-icon>
|
||||||
|
</button>
|
||||||
|
<button *ngIf="isLogedIn()" class="btn" (click)="updateService.executeAll()" [ngStyle]="{ 'visibility': updateService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + S" matTooltipPosition="below" matTooltipClass="pt-3" [matTooltipDisabled]="!updateService.isVisible">
|
||||||
|
<mat-icon class="scale-pulse" [matBadge]="updateActCount === 0 ? '' : updateActCount">save</mat-icon>
|
||||||
|
</button>
|
||||||
|
<button *ngIf="isLogedIn()" class="btn" (click)="transferService.executeAll()" [ngStyle]="{ 'visibility': transferService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + ␣" matTooltipPosition="below" [matTooltipDisabled]="!transferService.isVisible">
|
||||||
<mat-icon class="move-left-right">swap_horiz</mat-icon>
|
<mat-icon class="move-left-right">swap_horiz</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="isLogedIn()" class="btn" (click)="refreshService.executeAll()" [ngStyle]="{ 'visibility': refreshService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + R" matTooltipPosition="below" [matTooltipClass]="tooltipClass" [matTooltipDisabled]="!refreshService.isVisible">
|
<button *ngIf="isLogedIn()" class="btn" (click)="refreshService.executeAll()" [ngStyle]="{ 'visibility': refreshService.isVisible ? 'visible' : 'hidden' }" matTooltip="strg + R" matTooltipPosition="below" matTooltipClass="pt-3" [matTooltipDisabled]="!refreshService.isVisible">
|
||||||
<mat-icon class="turn-360">sync</mat-icon>
|
<mat-icon class="turn-360">sync</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="isLogedIn()" class="btn" (click)="showInfo()">
|
<button *ngIf="isLogedIn()" [ngStyle]="{ 'visibility': buttonVisibilityService.anyVisible ? 'visible' : 'hidden' }" class="btn" (click)="showInfo()">
|
||||||
<mat-icon class="scale-pulse">contact_support</mat-icon>
|
<mat-icon class="scale-pulse">contact_support</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse"
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse"
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { ColorModeBttnComponent } from '../common/color-mode-bttn/color-mode-btt
|
|||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { RefreshService } from '../../services/button/refresh.service';
|
import { RefreshService } from '../../services/button/refresh.service';
|
||||||
import { CreationService } from '../../services/button/creation.service';
|
import { CreationService } from '../../services/button/creation.service';
|
||||||
|
import { ButtonVisibilityService } from '../../services/button/button-visibility.service';
|
||||||
import { UpdateService, UpdateEvent } from '../../services/button/update.service';
|
import { UpdateService, UpdateEvent } from '../../services/button/update.service';
|
||||||
import { TransferService } from '../../services/button/transfer.service';
|
import { TransferService } from '../../services/button/transfer.service';
|
||||||
import { MatBadgeModule } from '@angular/material/badge';
|
import { MatBadgeModule } from '@angular/material/badge';
|
||||||
@@ -34,7 +35,7 @@ export class NavMenuComponent {
|
|||||||
|
|
||||||
isChecked = true;
|
isChecked = true;
|
||||||
|
|
||||||
constructor(private dialog: MatDialog, private authService: AuthenticationService, public refreshService: RefreshService, public creationService: CreationService, public updateService: UpdateService, public transferService: TransferService) {
|
constructor(private dialog: MatDialog, private authService: AuthenticationService, public refreshService: RefreshService, public creationService: CreationService, public updateService: UpdateService, public transferService: TransferService, public buttonVisibilityService: ButtonVisibilityService) {
|
||||||
this.authService.isAuthenticated().then().catch()
|
this.authService.isAuthenticated().then().catch()
|
||||||
this.updateActCount = this.updateService.totalCount;
|
this.updateActCount = this.updateService.totalCount;
|
||||||
this.updateService.addChangeListener(UpdateEvent.CountChange, () => {
|
this.updateService.addChangeListener(UpdateEvent.CountChange, () => {
|
||||||
@@ -73,11 +74,6 @@ export class NavMenuComponent {
|
|||||||
@ViewChildren(MatTooltip) tooltips: QueryList<MatTooltip> | undefined;
|
@ViewChildren(MatTooltip) tooltips: QueryList<MatTooltip> | undefined;
|
||||||
|
|
||||||
private __tooltip_timeout_set = false;
|
private __tooltip_timeout_set = false;
|
||||||
private __shift_tooltip: boolean = true;
|
|
||||||
get tooltipClass() {
|
|
||||||
this.__shift_tooltip = !this.__shift_tooltip;
|
|
||||||
return this.__shift_tooltip ? "pt-3" : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
showInfo() {
|
showInfo() {
|
||||||
this.tooltips?.forEach(t => {
|
this.tooltips?.forEach(t => {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export class UserTableComponent extends BaseTableComponent<User, UserService> {
|
|||||||
gosService: GroupOfUserService,
|
gosService: GroupOfUserService,
|
||||||
service: UserService,
|
service: UserService,
|
||||||
cModeService: ColorModeService) {
|
cModeService: ColorModeService) {
|
||||||
super(service, env.columnNames.user, cModeService)
|
super(service, env.columnNames.user.basic, cModeService)
|
||||||
this.mosService = mosService;
|
this.mosService = mosService;
|
||||||
this.gosService = gosService;
|
this.gosService = gosService;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<div class="container-fluid text-center">
|
<div class="container-fluid text-center">
|
||||||
<div class="row m-0 p-0">
|
<div class="row m-0 p-0">
|
||||||
<div class="col-6">
|
<div class="col-7">
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="Gruppen">
|
<mat-tab label="Gruppen">
|
||||||
<app-group-table #groupTable [onSelectedRows]="groupsOnSelectedRows" [cellEditing]="cellEditing"></app-group-table>
|
<app-group-table #groupTable [onSelectedRows]="groupsOnSelectedRows" [cellEditing]="cellEditing"></app-group-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-5">
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="Benutzer">
|
<mat-tab label="Benutzer">
|
||||||
<app-user-table #userTable [initData]="initWithoutData"></app-user-table>
|
<app-user-table #userTable [initData]="initWithoutData"></app-user-table>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class GroupComponent extends BasePageComponent implements AfterViewInit {
|
|||||||
cellEditing: GuiCellEdit = {
|
cellEditing: GuiCellEdit = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
cellEdit: (value: any, item: Group, index: number) => {
|
cellEdit: (value: any, item: Group, index: number) => {
|
||||||
if (!this.updateService.isEditable)
|
if (!this.updateService.isEditable || !item.internal)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this.updateService.setAsync("group_" + item.id!.toString(), async () => {
|
this.updateService.setAsync("group_" + item.id!.toString(), async () => {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<mat-tab label="Rechte Gruppe">
|
<mat-tab label="Rechte Gruppe">
|
||||||
<app-group-table #rightGroups] [columns]="groupRightColumns" [onSelectedRows]="rightGroupOnSelectedRows"></app-group-table>
|
<app-group-table #rightGroups] [columns]="groupRightColumns" [onSelectedRows]="rightGroupOnSelectedRows"></app-group-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>1
|
</mat-tab-group>
|
||||||
</div>
|
</div>
|
||||||
<!-- (1, 4): assigned users -->
|
<!-- (1, 4): assigned users -->
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="Benutzer">
|
<mat-tab label="Benutzer">
|
||||||
<app-user-table #userTable [onSelectedRows]="usersOnSelectedRows"
|
<app-user-table #userTable [onSelectedRows]="usersOnSelectedRows"
|
||||||
[cellEditing]="cellEditing"></app-user-table>
|
[cellEditing]="cellEditing" [columns]="detailed_user_columns"></app-user-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { BasePageComponent } from '../base-page/base-page.component';
|
|||||||
import { User } from '../../models/user-management.api.models';
|
import { User } from '../../models/user-management.api.models';
|
||||||
import { firstValueFrom, forkJoin } from 'rxjs';
|
import { firstValueFrom, forkJoin } from 'rxjs';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
import { env } from '../../../environments/environment'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -97,4 +98,8 @@ export class UserComponent extends BasePageComponent implements AfterViewInit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get detailed_user_columns() {
|
||||||
|
return env.columnNames.user.detailed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -34,4 +34,11 @@ export class ButtonVisibilityService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get anyVisible(): boolean {
|
||||||
|
for (const key in this._buttons)
|
||||||
|
if (this._buttons[key].isVisible)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,23 +16,72 @@ export const env = {
|
|||||||
loginCheck: "/auth/check"
|
loginCheck: "/auth/check"
|
||||||
},
|
},
|
||||||
columnNames: {
|
columnNames: {
|
||||||
user: [
|
user: {
|
||||||
{
|
basic: [
|
||||||
header: 'Benutzername',
|
{
|
||||||
field: 'username'
|
header: 'Benutzername',
|
||||||
},
|
field: 'username'
|
||||||
{
|
},
|
||||||
header: 'Vorname',
|
{
|
||||||
field: 'prename'
|
header: 'Vorname',
|
||||||
},
|
field: 'prename'
|
||||||
{
|
},
|
||||||
header: 'Name',
|
{
|
||||||
field: 'name'
|
header: 'Name',
|
||||||
},
|
field: 'name'
|
||||||
{
|
},
|
||||||
header: 'E-email',
|
{
|
||||||
field: 'email'
|
header: 'E-email',
|
||||||
}],
|
field: 'email'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
detailed: [
|
||||||
|
{
|
||||||
|
header: 'Benutzername',
|
||||||
|
field: 'username'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Vorname',
|
||||||
|
field: 'prename'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Name',
|
||||||
|
field: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'E-email',
|
||||||
|
field: 'email'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header:'Kommentar',
|
||||||
|
field: 'comment'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'DatumsFormat',
|
||||||
|
field: 'dateFormat'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Kürzel',
|
||||||
|
field: 'shortname'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Hinzugefügt<br>wer',
|
||||||
|
field: 'addedWho'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Hinzugefügt<br>wann',
|
||||||
|
field: 'addedWhen'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Geändert<br>wer',
|
||||||
|
field: 'changedWho'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Geändert<br>wann',
|
||||||
|
field: 'changedWhen'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
group: {
|
group: {
|
||||||
complete: [
|
complete: [
|
||||||
{
|
{
|
||||||
@@ -41,7 +90,11 @@ export const env = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: "Kommentar",
|
header: "Kommentar",
|
||||||
field: (group: any) => group.comment ?? ""
|
field: "comment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: "Active",
|
||||||
|
field: (group: any) => group.active ? "✓" : ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: "AD Sync",
|
header: "AD Sync",
|
||||||
@@ -50,6 +103,22 @@ export const env = {
|
|||||||
{
|
{
|
||||||
header: "Internal",
|
header: "Internal",
|
||||||
field: (group: any) => group.internal ? "✓" : ""
|
field: (group: any) => group.internal ? "✓" : ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Hinzugefügt<br>wer',
|
||||||
|
field: (g: any) => g.addedWho
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Hinzugefügt<br>wann',
|
||||||
|
field: (g: any) => new Date(g.addedWhen).toLocaleString('de-DE', { day: '2-digit', month: '2-digit', year: '2-digit', hour: '2-digit', minute: '2-digit' }).replace(',', '')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Geändert<br>wer',
|
||||||
|
field: 'changedWho'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'Geändert<br>wann',
|
||||||
|
field: (g: any) => new Date(g.changedWhen).toLocaleString('de-DE', { day: '2-digit', month: '2-digit', year: '2-digit', hour: '2-digit', minute: '2-digit' }).replace(',', '')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
representative: [
|
representative: [
|
||||||
@@ -125,4 +194,4 @@ export const env = {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
config_url: "/assets/config.json"
|
config_url: "/assets/config.json"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
using DigitalData.Core.API;
|
||||||
|
using DigitalData.Core.DTO;
|
||||||
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.API.Controllers
|
||||||
|
{
|
||||||
|
[Authorize]
|
||||||
|
public class BaseAuthController<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TBaseEntity> : CRUDControllerBaseWithErrorHandling<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TBaseEntity, int>
|
||||||
|
where TCRUDService : IBaseService<TCreateDto, TReadDto, TUpdateDto, TBaseEntity>
|
||||||
|
where TCreateDto : BaseCreateDto
|
||||||
|
where TReadDto : class
|
||||||
|
where TUpdateDto : BaseUpdateDto
|
||||||
|
where TBaseEntity : BaseEntity
|
||||||
|
{
|
||||||
|
private readonly Lazy<int?> _lUserId;
|
||||||
|
|
||||||
|
public BaseAuthController(ILogger logger, TCRUDService service, IUserService userService) : base(logger, service)
|
||||||
|
{
|
||||||
|
_lUserId = new(() =>
|
||||||
|
{
|
||||||
|
var idSt = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
|
bool hasId = int.TryParse(idSt, out int id);
|
||||||
|
return hasId ? id : null;
|
||||||
|
});
|
||||||
|
|
||||||
|
service.UserFactoryAsync = async () =>
|
||||||
|
{
|
||||||
|
var id = _lUserId.Value;
|
||||||
|
|
||||||
|
return id is int intId
|
||||||
|
? await userService.ReadByIdAsync(intId).ThenAsync(
|
||||||
|
Success: res => res,
|
||||||
|
Fail: UserReadDto? (m, n) =>
|
||||||
|
{
|
||||||
|
_logger.LogNotice(n);
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
using DigitalData.Core.API;
|
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.Group;
|
using DigitalData.UserManager.Application.DTOs.Group;
|
||||||
@@ -9,9 +8,9 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class GroupController : CRUDControllerBaseWithErrorHandling<IGroupService, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>
|
public class GroupController : BaseAuthController<IGroupService, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group>
|
||||||
{
|
{
|
||||||
public GroupController(ILogger<GroupController> logger, IGroupService service) : base(logger, service)
|
public GroupController(ILogger<GroupController> logger, IGroupService service, IUserService userService) : base(logger, service, userService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
using DigitalData.Core.Abstractions.Application;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
|
{
|
||||||
|
public interface IBaseService<TCreateDto, TReadDto, TUpdateDto, TBaseEntity> : ICRUDService<TCreateDto, TReadDto, TUpdateDto, TBaseEntity, int>
|
||||||
|
where TCreateDto : BaseCreateDto
|
||||||
|
where TReadDto : class
|
||||||
|
where TUpdateDto : BaseUpdateDto
|
||||||
|
where TBaseEntity : BaseEntity
|
||||||
|
{
|
||||||
|
|
||||||
|
public Func<Task<UserReadDto?>> UserFactoryAsync { set; }
|
||||||
|
|
||||||
|
public Task<UserReadDto?> GetUserAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,11 @@
|
|||||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
|
using DigitalData.UserManager.Application.Services;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IGroupOfUserService : ICRUDService<GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int>
|
public interface IGroupOfUserService : IBaseService<GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser>
|
||||||
{
|
{
|
||||||
Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId);
|
Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
using DigitalData.UserManager.Application.DTOs.Group;
|
||||||
using DigitalData.UserManager.Application.DTOs.Group;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IGroupService : ICRUDService<GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>
|
public interface IGroupService : IBaseService<GroupCreateDto, GroupReadDto, GroupUpdateDto, Group>
|
||||||
{
|
{
|
||||||
Task<DataResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
Task<DataResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
|
using DigitalData.UserManager.Application.Services;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IUserRepService : ICRUDService<UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>
|
public interface IUserRepService : IBaseService<UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep>
|
||||||
{
|
{
|
||||||
Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null);
|
Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IUserService : ICRUDService<UserCreateDto, UserReadDto, UserUpdateDto, User, int>
|
public interface IUserService : IBaseService<UserCreateDto, UserReadDto, UserUpdateDto, User>
|
||||||
{
|
{
|
||||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace DigitalData.UserManager.Application.DTOs.Base
|
||||||
|
{
|
||||||
|
public record BaseCreateDto()
|
||||||
|
{
|
||||||
|
public string AddedWho { get; set; } = "UNAUTHORIZED";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
using DigitalData.Core.DTO;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.Base
|
||||||
|
{
|
||||||
|
public record BaseReadDto(int Id, string? AddedWho, DateTime? AddedWhen, string? ChangedWho, DateTime? ChangedWhen) : BaseDTO<int>(Id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace DigitalData.UserManager.Application.DTOs.Base
|
||||||
|
{
|
||||||
|
public record BaseUpdateDto()
|
||||||
|
{
|
||||||
|
public string ChangedWho { get; set; } = "UNAUTHORIZED";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.Group
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.Group
|
||||||
{
|
{
|
||||||
public record GroupCreateDto
|
public record GroupCreateDto
|
||||||
(
|
(
|
||||||
@@ -7,8 +9,6 @@
|
|||||||
bool? Internal,
|
bool? Internal,
|
||||||
bool? Active,
|
bool? Active,
|
||||||
string? Comment,
|
string? Comment,
|
||||||
string? AddedWho,
|
|
||||||
string? ChangedWho,
|
|
||||||
int EcmFkId
|
int EcmFkId
|
||||||
);
|
) : BaseCreateDto();
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.Group
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.Group
|
||||||
{
|
{
|
||||||
public record GroupReadDto
|
public record GroupReadDto
|
||||||
(
|
(
|
||||||
@@ -9,6 +11,8 @@
|
|||||||
bool? Active,
|
bool? Active,
|
||||||
string? Comment,
|
string? Comment,
|
||||||
string? AddedWho,
|
string? AddedWho,
|
||||||
string? ChangedWho
|
DateTime? AddedWhen,
|
||||||
);
|
string? ChangedWho,
|
||||||
|
DateTime? ChangedWhen
|
||||||
|
) : BaseReadDto(Id, AddedWho, AddedWhen, ChangedWho, ChangedWhen);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.Group
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.Group
|
||||||
{
|
{
|
||||||
public record GroupUpdateDto
|
public record GroupUpdateDto
|
||||||
(
|
(
|
||||||
@@ -9,5 +11,5 @@
|
|||||||
bool? Active,
|
bool? Active,
|
||||||
string? Comment,
|
string? Comment,
|
||||||
string? ChangedWho
|
string? ChangedWho
|
||||||
);
|
) : BaseUpdateDto();
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||||
{
|
{
|
||||||
public record GroupOfUserCreateDto(
|
public record GroupOfUserCreateDto(
|
||||||
int UserId,
|
int UserId,
|
||||||
int GroupId,
|
int GroupId,
|
||||||
string? Comment,
|
string? Comment
|
||||||
string? AddedWho
|
) : BaseCreateDto();
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.UserManager.Application.DTOs.Group;
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.Group;
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||||
@@ -11,6 +12,8 @@ namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
|||||||
string AddedWho,
|
string AddedWho,
|
||||||
string? ChangedWho,
|
string? ChangedWho,
|
||||||
UserReadDto User,
|
UserReadDto User,
|
||||||
GroupReadDto Group
|
GroupReadDto Group,
|
||||||
);
|
DateTime? AddedWhen,
|
||||||
|
DateTime? ChangedWhen
|
||||||
|
) : BaseReadDto(Id, AddedWho, AddedWhen, ChangedWho, ChangedWhen);
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||||
{
|
{
|
||||||
public record GroupOfUserUpdateDto(
|
public record GroupOfUserUpdateDto(
|
||||||
int Id,
|
int Id,
|
||||||
int? UserId,
|
int? UserId,
|
||||||
int? GroupId,
|
int? GroupId,
|
||||||
string? Comment,
|
string? Comment
|
||||||
string? ChangedWho
|
) : BaseUpdateDto();
|
||||||
);
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.User
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.User
|
||||||
{
|
{
|
||||||
public record class UserCreateDto
|
public record class UserCreateDto() : BaseCreateDto()
|
||||||
{
|
{
|
||||||
public string? Prename { get; init; }
|
public string? Prename { get; init; }
|
||||||
public string? Name { get; init; }
|
public string? Name { get; init; }
|
||||||
@@ -11,7 +13,6 @@
|
|||||||
public string? Comment { get; init; }
|
public string? Comment { get; init; }
|
||||||
public bool? Deleted { get; init; }
|
public bool? Deleted { get; init; }
|
||||||
public string DateFormat { get; init; } = "dd.MM.yyyy";
|
public string DateFormat { get; init; } = "dd.MM.yyyy";
|
||||||
public string AddedWho { get; init; } = "DEFAULT";
|
|
||||||
public string? ChangedWho { get; init; }
|
public string? ChangedWho { get; init; }
|
||||||
public bool Active { get; init; } = true;
|
public bool Active { get; init; } = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.User
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.User
|
||||||
{
|
{
|
||||||
public record UserUpdateDto(
|
public record UserUpdateDto(
|
||||||
int Id,
|
int Id,
|
||||||
@@ -11,8 +13,6 @@
|
|||||||
string? Comment,
|
string? Comment,
|
||||||
bool? Deleted,
|
bool? Deleted,
|
||||||
string? DateFormat,
|
string? DateFormat,
|
||||||
string? AddedWho,
|
|
||||||
string? ChangedWho,
|
|
||||||
bool? Active
|
bool? Active
|
||||||
);
|
) : BaseUpdateDto();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
||||||
{
|
{
|
||||||
public record UserRepCreateDto(
|
public record UserRepCreateDto(
|
||||||
int UserId,
|
int UserId,
|
||||||
@@ -6,5 +8,5 @@
|
|||||||
int RightGroupId,
|
int RightGroupId,
|
||||||
string AddedWho,
|
string AddedWho,
|
||||||
int RepUserId
|
int RepUserId
|
||||||
);
|
) : BaseCreateDto();
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.UserManager.Application.DTOs.Group;
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.Group;
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
||||||
@@ -9,10 +10,13 @@ namespace DigitalData.UserManager.Application.DTOs.UserRep
|
|||||||
int? RepGroupId,
|
int? RepGroupId,
|
||||||
int RightGroupId,
|
int RightGroupId,
|
||||||
string AddedWho,
|
string AddedWho,
|
||||||
|
string ChangedWho,
|
||||||
int? RepUserId,
|
int? RepUserId,
|
||||||
UserReadDto? User,
|
UserReadDto? User,
|
||||||
GroupReadDto? RepGroup,
|
GroupReadDto? RepGroup,
|
||||||
GroupReadDto? RightGroup,
|
GroupReadDto? RightGroup,
|
||||||
UserReadDto? RepUser
|
UserReadDto? RepUser,
|
||||||
);
|
DateTime? AddedWhen,
|
||||||
|
DateTime? ChangedWhen
|
||||||
|
) : BaseReadDto(Id, AddedWho, AddedWhen, ChangedWho, ChangedWhen);
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
||||||
{
|
{
|
||||||
public record UserRepUpdateDto(
|
public record UserRepUpdateDto(
|
||||||
int UserId,
|
int UserId,
|
||||||
int? RepGroupId,
|
int? RepGroupId,
|
||||||
int RightGroupId,
|
int RightGroupId,
|
||||||
int RepUserId
|
int RepUserId
|
||||||
);
|
) : BaseUpdateDto();
|
||||||
}
|
}
|
||||||
51
DigitalData.UserManager.Application/Services/BaseService.cs
Normal file
51
DigitalData.UserManager.Application/Services/BaseService.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using DigitalData.Core.Application;
|
||||||
|
using DigitalData.Core.DTO;
|
||||||
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.Base;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Services
|
||||||
|
{
|
||||||
|
public class BaseService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TBaseEntity> : CRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TBaseEntity, int>, IBaseService<TCreateDto, TReadDto, TUpdateDto, TBaseEntity>
|
||||||
|
where TCRUDRepository : ICRUDRepository<TBaseEntity, int>
|
||||||
|
where TCreateDto : BaseCreateDto
|
||||||
|
where TReadDto : class
|
||||||
|
where TUpdateDto : BaseUpdateDto
|
||||||
|
where TBaseEntity : BaseEntity
|
||||||
|
{
|
||||||
|
public BaseService(TCRUDRepository repository, IMapper mapper) : base(repository, mapper)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private Lazy<Task<UserReadDto?>>? _lazyUserAsync = null;
|
||||||
|
|
||||||
|
public Func<Task<UserReadDto?>> UserFactoryAsync { set => _lazyUserAsync = new Lazy<Task<UserReadDto?>>(value); }
|
||||||
|
|
||||||
|
public async Task<UserReadDto?> GetUserAsync() => _lazyUserAsync is null ? null : await _lazyUserAsync.Value;
|
||||||
|
|
||||||
|
public override async Task<DataResult<int>> CreateAsync(TCreateDto createDto)
|
||||||
|
{
|
||||||
|
var user = await GetUserAsync();
|
||||||
|
if(user is not null)
|
||||||
|
{
|
||||||
|
createDto.AddedWho = user.Username;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await base.CreateAsync(createDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task<Result> UpdateAsync(TUpdateDto updateDto)
|
||||||
|
{
|
||||||
|
var user = await GetUserAsync();
|
||||||
|
if (user is not null)
|
||||||
|
{
|
||||||
|
updateDto.ChangedWho = user.Username;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await base.UpdateAsync(updateDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ using DigitalData.UserManager.Infrastructure.Contracts;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class GroupOfUserService : CRUDService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser, int>, IGroupOfUserService
|
public class GroupOfUserService : BaseService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser>, IGroupOfUserService
|
||||||
{
|
{
|
||||||
public GroupOfUserService(IGroupOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
public GroupOfUserService(IGroupOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using DigitalData.Core.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.Group;
|
using DigitalData.UserManager.Application.DTOs.Group;
|
||||||
@@ -9,7 +8,7 @@ using Microsoft.Extensions.Localization;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class GroupService : CRUDService<IGroupRepository, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group, int>, IGroupService
|
public class GroupService : BaseService<IGroupRepository, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group>, IGroupService
|
||||||
{
|
{
|
||||||
private readonly IStringLocalizer<Resource> _localizer;
|
private readonly IStringLocalizer<Resource> _localizer;
|
||||||
public GroupService(IGroupRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
public GroupService(IGroupRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
||||||
@@ -17,15 +16,14 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
_localizer = localizer;
|
_localizer = localizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<DataResult<int>> CreateAsync(GroupCreateDto createDto)
|
|
||||||
{
|
|
||||||
return base.CreateAsync(createDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<DataResult<int>> CreateAsync(DirectoryGroupDto adGroup)
|
public async Task<DataResult<int>> CreateAsync(DirectoryGroupDto adGroup)
|
||||||
{
|
{
|
||||||
var group = _mapper.MapOrThrow<Group>(adGroup);
|
var group = _mapper.MapOrThrow<Group>(adGroup);
|
||||||
|
|
||||||
|
//set the user
|
||||||
|
var user = await GetUserAsync();
|
||||||
|
group.AddedWho = user?.AddedWho ?? "UNAUTHORIZED";
|
||||||
|
|
||||||
if (await HasEntity(group.Id))
|
if (await HasEntity(group.Id))
|
||||||
return Result.Fail<int>().Message(_localizer[Key.GroupAlreadyExists.ToString()]);
|
return Result.Fail<int>().Message(_localizer[Key.GroupAlreadyExists.ToString()]);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Microsoft.Extensions.Localization;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class UserRepService : CRUDService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep, int>, IUserRepService
|
public class UserRepService : BaseService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep>, IUserRepService
|
||||||
{
|
{
|
||||||
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Microsoft.Extensions.Localization;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class UserService : CRUDService<IUserRepository, UserCreateDto, UserReadDto, UserUpdateDto, User, int>, IUserService
|
public class UserService : BaseService<IUserRepository, UserCreateDto, UserReadDto, UserUpdateDto, User>, IUserService
|
||||||
{
|
{
|
||||||
private readonly IStringLocalizer<Resource> _localizer;
|
private readonly IStringLocalizer<Resource> _localizer;
|
||||||
public UserService(IUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
public UserService(IUserRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
||||||
|
|||||||
29
DigitalData.UserManager.Domain/Entities/BaseEntity.cs
Normal file
29
DigitalData.UserManager.Domain/Entities/BaseEntity.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Domain.Entities
|
||||||
|
{
|
||||||
|
public class BaseEntity
|
||||||
|
{
|
||||||
|
[Column("GUID")]
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[StringLength(50)]
|
||||||
|
[Column("ADDED_WHO")]
|
||||||
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
[StringLength(50)]
|
||||||
|
[Column("CHANGED_WHO")]
|
||||||
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
[Column("ADDED_WHEN", TypeName = "datetime")]
|
||||||
|
[DefaultValue("GETDATE()")]
|
||||||
|
public DateTime AddedWhen { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
[Column("CHANGED_WHEN", TypeName = "datetime")]
|
||||||
|
public DateTime? ChangedWhen { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,13 +5,8 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
namespace DigitalData.UserManager.Domain.Entities
|
namespace DigitalData.UserManager.Domain.Entities
|
||||||
{
|
{
|
||||||
[Table("TBDD_GROUPS", Schema = "dbo")]
|
[Table("TBDD_GROUPS", Schema = "dbo")]
|
||||||
public class Group
|
public class Group : BaseEntity
|
||||||
{
|
{
|
||||||
[Column("GUID")]
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[StringLength(50)]
|
[StringLength(50)]
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
@@ -31,27 +26,9 @@ namespace DigitalData.UserManager.Domain.Entities
|
|||||||
[StringLength(200)]
|
[StringLength(200)]
|
||||||
public string? Comment { get; set; }
|
public string? Comment { get; set; }
|
||||||
|
|
||||||
[StringLength(50)]
|
|
||||||
[DefaultValue("DEFAULT")]
|
|
||||||
[Column("ADDED_WHO")]
|
|
||||||
public string? AddedWho { get; set; }
|
|
||||||
|
|
||||||
[StringLength(50)]
|
|
||||||
[Column("CHANGED_WHO")]
|
|
||||||
public string? ChangedWho { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[Column("ECM_FK_ID")]
|
[Column("ECM_FK_ID")]
|
||||||
[DefaultValue(0)]
|
[DefaultValue(0)]
|
||||||
public int EcmFkId { get; set; }
|
public int EcmFkId { get; set; }
|
||||||
|
|
||||||
#region IGNORED COLUMNS
|
|
||||||
//[Column(TypeName = "datetime")]
|
|
||||||
//[DefaultValue("GETDATE()")]
|
|
||||||
//public DateTime? AddedWhen { get; set; }
|
|
||||||
|
|
||||||
//[Column(TypeName = "datetime")]
|
|
||||||
//public DateTime? ChangedWhen { get; set; }
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,8 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
namespace DigitalData.UserManager.Domain.Entities
|
namespace DigitalData.UserManager.Domain.Entities
|
||||||
{
|
{
|
||||||
[Table("TBDD_GROUPS_USER", Schema = "dbo")]
|
[Table("TBDD_GROUPS_USER", Schema = "dbo")]
|
||||||
public class GroupOfUser
|
public class GroupOfUser : BaseEntity
|
||||||
{
|
{
|
||||||
[Column("GUID")]
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[Column("USER_ID")]
|
[Column("USER_ID")]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
@@ -23,27 +18,10 @@ namespace DigitalData.UserManager.Domain.Entities
|
|||||||
[StringLength(200)]
|
[StringLength(200)]
|
||||||
public string? Comment { get; set; }
|
public string? Comment { get; set; }
|
||||||
|
|
||||||
[StringLength(50)]
|
|
||||||
[DefaultValue("DEFAULT")]
|
|
||||||
[Column("ADDED_WHO")]
|
|
||||||
public string AddedWho { get; set; } = "DEFAULT";
|
|
||||||
|
|
||||||
[StringLength(50)]
|
|
||||||
[Column("CHANGED_WHO")]
|
|
||||||
public string? ChangedWho { get; set; }
|
|
||||||
|
|
||||||
[ForeignKey("UserId")]
|
[ForeignKey("UserId")]
|
||||||
public virtual User? User { get; set; }
|
public virtual User? User { get; set; }
|
||||||
|
|
||||||
[ForeignKey("GroupId")]
|
[ForeignKey("GroupId")]
|
||||||
public virtual Group? Group { get; set; }
|
public virtual Group? Group { get; set; }
|
||||||
|
|
||||||
#region IGNORED COLUMN
|
|
||||||
//[DefaultValue("getdate()")]
|
|
||||||
//public DateTime? AddedWhen { get; set; }
|
|
||||||
|
|
||||||
//public DateTime? ChangedWhen { get; set; }
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,8 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
namespace DigitalData.UserManager.Domain.Entities
|
namespace DigitalData.UserManager.Domain.Entities
|
||||||
{
|
{
|
||||||
[Table("TBDD_USER", Schema = "dbo")]
|
[Table("TBDD_USER", Schema = "dbo")]
|
||||||
public class User
|
public class User : BaseEntity
|
||||||
{
|
{
|
||||||
[Column("GUID")]
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[Column("PRENAME")]
|
[Column("PRENAME")]
|
||||||
[StringLength(50)]
|
[StringLength(50)]
|
||||||
public string? Prename { get; set; }
|
public string? Prename { get; set; }
|
||||||
@@ -52,16 +47,6 @@ namespace DigitalData.UserManager.Domain.Entities
|
|||||||
[DefaultValue("dd.MM.yyyy")]
|
[DefaultValue("dd.MM.yyyy")]
|
||||||
public string DateFormat { get; set; }
|
public string DateFormat { get; set; }
|
||||||
|
|
||||||
[Required]
|
|
||||||
[Column("ADDED_WHO")]
|
|
||||||
[StringLength(50)]
|
|
||||||
[DefaultValue("DEFAULT")]
|
|
||||||
public string AddedWho { get; set; }
|
|
||||||
|
|
||||||
[Column("CHANGED_WHO")]
|
|
||||||
[StringLength(50)]
|
|
||||||
public string? ChangedWho { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[Column("ACTIVE")]
|
[Column("ACTIVE")]
|
||||||
public bool Active { get; set; }
|
public bool Active { get; set; }
|
||||||
@@ -87,14 +72,6 @@ namespace DigitalData.UserManager.Domain.Entities
|
|||||||
//[Column("DELETED_WHO")]
|
//[Column("DELETED_WHO")]
|
||||||
//[StringLength(50)]
|
//[StringLength(50)]
|
||||||
//public string? DeletedWho { get; set; }
|
//public string? DeletedWho { get; set; }
|
||||||
|
|
||||||
//[Required]
|
|
||||||
//[Column("ADDED_WHEN")]
|
|
||||||
//[DefaultValue("getdate()")]
|
|
||||||
//public DateTime? AddedWhen { get; set; }
|
|
||||||
|
|
||||||
//[Column("CHANGED_WHEN")]
|
|
||||||
//public DateTime? ChangedWhen { get; set; }
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,8 @@ using System.ComponentModel;
|
|||||||
namespace DigitalData.UserManager.Domain.Entities
|
namespace DigitalData.UserManager.Domain.Entities
|
||||||
{
|
{
|
||||||
[Table("TBDD_USER_REPRESENTATION", Schema = "dbo")]
|
[Table("TBDD_USER_REPRESENTATION", Schema = "dbo")]
|
||||||
public class UserRep
|
public class UserRep : BaseEntity
|
||||||
{
|
{
|
||||||
[Column("GUID")]
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[Column("USER_ID")]
|
[Column("USER_ID")]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
@@ -23,16 +18,6 @@ namespace DigitalData.UserManager.Domain.Entities
|
|||||||
[Column("RIGHT_GROUP")]
|
[Column("RIGHT_GROUP")]
|
||||||
public int RightGroupId { get; set; }
|
public int RightGroupId { get; set; }
|
||||||
|
|
||||||
[Required]
|
|
||||||
[StringLength(50)]
|
|
||||||
[DefaultValue("DEFAULT")]
|
|
||||||
[Column("ADDED_WHO")]
|
|
||||||
public string AddedWho { get; set; }
|
|
||||||
|
|
||||||
[StringLength(50)]
|
|
||||||
[Column("CHANGED_WHO")]
|
|
||||||
public string? ChangedWho { get; set; }
|
|
||||||
|
|
||||||
[Column("REPR_USER")]
|
[Column("REPR_USER")]
|
||||||
public int? RepUserId { get; set; }
|
public int? RepUserId { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user