Compare commits
54 Commits
c060cd9083
...
feat/authF
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1155cb406 | ||
|
|
9ae3345859 | ||
|
|
a4e4883d6b | ||
|
|
9f6acfb8d3 | ||
|
|
be78947b48 | ||
|
|
b2e64e794c | ||
|
|
d6b82cf085 | ||
|
|
6cd72fe755 | ||
|
|
8d0beab709 | ||
|
|
52871f006d | ||
|
|
ac064f4671 | ||
|
|
2d792c8544 | ||
|
|
239a5708a7 | ||
|
|
23283a6846 | ||
|
|
7d317308d5 | ||
|
|
2aab942563 | ||
|
|
054c91609e | ||
|
|
5c097eda80 | ||
|
|
d228a3cd50 | ||
|
|
0786013bd0 | ||
|
|
beabc3f4e0 | ||
|
|
44560e7057 | ||
|
|
2098a7d48d | ||
|
|
140f172369 | ||
|
|
b3e7c1aa99 | ||
|
|
0d4436b061 | ||
|
|
b88fd78367 | ||
|
|
7670f2119e | ||
|
|
a142196d87 | ||
|
|
59e8c6c0c6 | ||
|
|
3cf1215a1c | ||
|
|
81c00401b7 | ||
|
|
e86b42d955 | ||
|
|
80d28e12b9 | ||
|
|
7fc71f427b | ||
|
|
bd7d521c1e | ||
|
|
33326866f9 | ||
|
|
fbf9bbeba0 | ||
|
|
b7f8ea1e8e | ||
|
|
6fc8bdc964 | ||
|
|
b3d46aaf30 | ||
|
|
2870f0e18e | ||
|
|
337a0b892e | ||
|
|
2e1bf69889 | ||
|
|
0657bbe2c4 | ||
|
|
acfd9b4fb8 | ||
|
|
0f9ac0e637 | ||
|
|
0a8a5208a0 | ||
|
|
b1011c3ea2 | ||
|
|
11913ea667 | ||
|
|
ff6ebf300c | ||
|
|
7e05123fbf | ||
|
|
712932a0e2 | ||
|
|
a946ba871d |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
12
DigitalData.UserManager.API/.config/dotnet-tools.json
Normal file
12
DigitalData.UserManager.API/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"dotnet-ef": {
|
||||||
|
"version": "9.0.3",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-ef"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "user-manager-ui",
|
"name": "user-manager-ui",
|
||||||
"version": "0.0.0",
|
"version": "4.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve --ssl -o",
|
"start": "ng serve --ssl -o",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="dd-row input-row">
|
<div class="dd-row input-row">
|
||||||
<mat-form-field class="w40p">
|
<mat-form-field class="w40p">
|
||||||
<mat-label>Geben Sie einen Datumsbereich ein</mat-label>
|
<mat-label>Geben Sie einen Datumsbereich ein</mat-label>
|
||||||
<mat-date-range-input [formGroup]="range" [rangePicker]="picker">
|
<mat-date-range-input [formGroup]="range" [rangePicker]="picker" [disabled]="termless">
|
||||||
<input matStartDate formControlName="start" placeholder="Start date">
|
<input matStartDate formControlName="start" placeholder="Start date">
|
||||||
<input matEndDate formControlName="end" placeholder="End date">
|
<input matEndDate formControlName="end" placeholder="End date">
|
||||||
</mat-date-range-input>
|
</mat-date-range-input>
|
||||||
@@ -17,6 +17,9 @@
|
|||||||
<mat-error>Ungültiges Enddatum</mat-error>
|
<mat-error>Ungültiges Enddatum</mat-error>
|
||||||
}
|
}
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<mat-slide-toggle [(ngModel)]="termless" class="w20p">
|
||||||
|
Unbefristet
|
||||||
|
</mat-slide-toggle>
|
||||||
<button mat-fab extended (click)="create()" class="w20p">
|
<button mat-fab extended (click)="create()" class="w20p">
|
||||||
<mat-icon>playlist_add</mat-icon>
|
<mat-icon>playlist_add</mat-icon>
|
||||||
Erstellen
|
Erstellen
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
.dd-row mat-form-field {
|
||||||
|
margin: 1rem 0rem 0rem 0rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dd-row mat-slide-toggle {
|
||||||
|
margin: 1rem 0rem 1rem 0rem;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import { MatButtonModule } from '@angular/material/button';
|
|||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { provideMomentDateAdapter } from '@angular/material-moment-adapter';
|
import { provideMomentDateAdapter } from '@angular/material-moment-adapter';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||||
import 'moment/locale/de';
|
import 'moment/locale/de';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -23,7 +24,7 @@ import 'moment/locale/de';
|
|||||||
{ provide: MAT_DATE_LOCALE, useValue: 'de-DE' },
|
{ provide: MAT_DATE_LOCALE, useValue: 'de-DE' },
|
||||||
provideMomentDateAdapter()
|
provideMomentDateAdapter()
|
||||||
],
|
],
|
||||||
imports: [MatFormFieldModule, MatDatepickerModule, FormsModule, ReactiveFormsModule, JsonPipe, MatButtonModule, MatIconModule, MatInputModule],
|
imports: [MatFormFieldModule, MatDatepickerModule, FormsModule, ReactiveFormsModule, JsonPipe, MatButtonModule, MatIconModule, MatInputModule, MatSlideToggleModule],
|
||||||
templateUrl: './rep-create-form.component.html',
|
templateUrl: './rep-create-form.component.html',
|
||||||
styleUrl: './rep-create-form.component.scss',
|
styleUrl: './rep-create-form.component.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
@@ -41,6 +42,7 @@ export class RepCreateFormComponent implements OnInit {
|
|||||||
private readonly _locale = signal(inject<unknown>(MAT_DATE_LOCALE));
|
private readonly _locale = signal(inject<unknown>(MAT_DATE_LOCALE));
|
||||||
private readonly _adapter = inject<DateAdapter<unknown, unknown>>(DateAdapter);
|
private readonly _adapter = inject<DateAdapter<unknown, unknown>>(DateAdapter);
|
||||||
private readonly _intl = inject(MatDatepickerIntl);
|
private readonly _intl = inject(MatDatepickerIntl);
|
||||||
|
termless: boolean = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const dialogData: { userRep: UserRep, afterCreation: (any: any) => any } = inject(MAT_DIALOG_DATA)
|
const dialogData: { userRep: UserRep, afterCreation: (any: any) => any } = inject(MAT_DIALOG_DATA)
|
||||||
@@ -69,18 +71,20 @@ export class RepCreateFormComponent implements OnInit {
|
|||||||
const validFrom = this.range.value.start;
|
const validFrom = this.range.value.start;
|
||||||
const validTo = this.range.value.end;
|
const validTo = this.range.value.end;
|
||||||
|
|
||||||
if (!validFrom || !validTo) {
|
if ((!validFrom || !validTo) && !this.termless) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: "error",
|
icon: "error",
|
||||||
title: "Oops...",
|
title: "Oops...",
|
||||||
text: "Bitte geben Sie einen gültigen Datumsbereich ein!",
|
text: "Bitte geben Sie einen gültigen Datumsbereich ein oder wählen Sie unbefristet!",
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.termless) {
|
||||||
this.userRep.validFrom = validFrom!;
|
this.userRep.validFrom = validFrom!;
|
||||||
this.userRep.validTo = validTo!;
|
this.userRep.validTo = validTo!;
|
||||||
|
}
|
||||||
|
|
||||||
this.userRepService.create(this.userRep).subscribe({
|
this.userRepService.create(this.userRep).subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
|
|||||||
@@ -13,5 +13,8 @@
|
|||||||
[infoPanel]="infoPanel"
|
[infoPanel]="infoPanel"
|
||||||
[titlePanel]="titlePanel"
|
[titlePanel]="titlePanel"
|
||||||
[theme]="theme"
|
[theme]="theme"
|
||||||
(selectedRows)="onSelectedRows($event)">
|
[rowStyle] = "rowStyle"
|
||||||
|
[rowClass] = "rowClass"
|
||||||
|
(selectedRows)="onSelectedRows($event)"
|
||||||
|
(click)="click && click(this)">
|
||||||
</gui-grid>
|
</gui-grid>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, Inject, Input, OnDestroy, OnInit, ViewChild, input } from '@angular/core';
|
import { Component, Inject, Input, OnDestroy, OnInit, ViewChild, input } from '@angular/core';
|
||||||
import { ApiService } from '../../../services/api/user-management.api.service';
|
import { ApiService } from '../../../services/api/user-management.api.service';
|
||||||
import { GuiGridModule, GuiColumn, GuiColumnMenu, GuiSorting, GuiRowDetail, GuiPaging, GuiPagingDisplay, GuiSearching, GuiCellEdit, GuiInfoPanel, GuiTitlePanel, GuiRowSelection, GuiSelectedRow, GuiGridComponent, GuiGridApi, GuiTheme } from '@generic-ui/ngx-grid';
|
import { GuiGridModule, GuiColumn, GuiColumnMenu, GuiSorting, GuiRowDetail, GuiPaging, GuiPagingDisplay, GuiSearching, GuiCellEdit, GuiInfoPanel, GuiTitlePanel, GuiRowSelection, GuiSelectedRow, GuiGridComponent, GuiGridApi, GuiTheme, GuiRowStyle, GuiRowClass } from '@generic-ui/ngx-grid';
|
||||||
import { Subscription } from 'rxjs/internal/Subscription';
|
import { Subscription } from 'rxjs/internal/Subscription';
|
||||||
import { ColorModeService, Theme } from '../../../services/button/color-mode.service';
|
import { ColorModeService, Theme } from '../../../services/button/color-mode.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@@ -8,7 +8,7 @@ import { FormsModule } from '@angular/forms';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, FormsModule, GuiGridModule ],
|
imports: [CommonModule, FormsModule, GuiGridModule],
|
||||||
selector: 'app-base-table',
|
selector: 'app-base-table',
|
||||||
templateUrl: './base-table.component.html',
|
templateUrl: './base-table.component.html',
|
||||||
styleUrl: './base-table.component.css'
|
styleUrl: './base-table.component.css'
|
||||||
@@ -69,6 +69,10 @@ export class BaseTableComponent<TModel, TApiService extends ApiService<TModel>>
|
|||||||
|
|
||||||
private themeSubscription: Subscription = new Subscription();
|
private themeSubscription: Subscription = new Subscription();
|
||||||
|
|
||||||
|
private static count: number = 0;
|
||||||
|
|
||||||
|
public readonly id: number = (BaseTableComponent.count++)
|
||||||
|
|
||||||
constructor(@Inject(ApiService<TModel>) service: TApiService, columns: Array<GuiColumn>, private cModeService: ColorModeService) {
|
constructor(@Inject(ApiService<TModel>) service: TApiService, columns: Array<GuiColumn>, private cModeService: ColorModeService) {
|
||||||
this.service = service;
|
this.service = service;
|
||||||
if (this.columns.length == 0)
|
if (this.columns.length == 0)
|
||||||
@@ -111,6 +115,12 @@ export class BaseTableComponent<TModel, TApiService extends ApiService<TModel>>
|
|||||||
|
|
||||||
@Input() columns: Array<GuiColumn> = [];
|
@Input() columns: Array<GuiColumn> = [];
|
||||||
|
|
||||||
|
@Input() rowStyle: GuiRowStyle = {}
|
||||||
|
|
||||||
|
@Input() rowClass: GuiRowClass = {}
|
||||||
|
|
||||||
|
@Input() click: ((table: BaseTableComponent<TModel, TApiService>) => void) | undefined;
|
||||||
|
|
||||||
selected: boolean = false;
|
selected: boolean = false;
|
||||||
safelyUnselectAll() {
|
safelyUnselectAll() {
|
||||||
this.selected = true
|
this.selected = true
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { UserRep } from '../../../models/user-management.api.models';
|
import { UserRep } from '../../../models/user-management.api.models';
|
||||||
import { UserRepService } from '../../../services/api/user-representation.service';
|
import { UserRepService } from '../../../services/api/user-representation.service';
|
||||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||||
import { GuiGridModule, GuiColumn } from '@generic-ui/ngx-grid';
|
import { GuiGridModule } from '@generic-ui/ngx-grid';
|
||||||
import { ColorModeService } from '../../../services/button/color-mode.service';
|
import { ColorModeService } from '../../../services/button/color-mode.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="Benutzer">
|
<mat-tab label="Benutzer">
|
||||||
<app-user-table #users [onSelectedRows]="userOnSelectedRows"></app-user-table>
|
<app-user-table #users [click]="userOnClick"></app-user-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Gruppe">
|
<mat-tab label="Gruppe">
|
||||||
<app-group-table #groups [columns]="groupColumns" [onSelectedRows]="groupOnSelectedRows"></app-group-table>
|
<app-group-table #groups [columns]="groupColumns" [click]="groupOnClick"></app-group-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
</div>
|
</div>
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="Rep. Benutzer">
|
<mat-tab label="Rep. Benutzer">
|
||||||
<app-user-table #repUsers [onSelectedRows]="repUserOnSelectedRows"></app-user-table>
|
<app-user-table #repUsers [click]="repUserOnClick"></app-user-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Rep. Gruppen">
|
<mat-tab label="Rep. Gruppen">
|
||||||
<app-group-table #repGroups [columns]="groupRepCols" [onSelectedRows]="repGroupOnSelectedRows"></app-group-table>
|
<app-group-table #repGroups [columns]="groupRepCols" [click]="repGroupOnClick"></app-group-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
</div>
|
</div>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="{{useRepLabel}}">
|
<mat-tab label="{{useRepLabel}}">
|
||||||
<app-user-rep-table #userReps [initData]="initWithoutData" [onSelectedRows]="repOnSelectedRows"></app-user-rep-table>
|
<app-user-rep-table #userReps [initData]="initWithoutData" [rowClass]="rep_row_class" [click]="repOnClick"></app-user-rep-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { AfterViewInit, Component, ViewChild, inject } from '@angular/core';
|
import { AfterViewInit, Component, ViewChild, inject } from '@angular/core';
|
||||||
import { GuiColumn, GuiSelectedRow } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
|
import { GuiColumn, GuiRowClass, GuiRowStyle, GuiSelectedRow } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
|
||||||
import { UserTableComponent } from '../../components/tables/user-table/user-table.component';
|
import { UserTableComponent } from '../../components/tables/user-table/user-table.component';
|
||||||
import { UserRepTableComponent } from '../../components/tables/user-rep-table/user-rep-table.component';
|
import { UserRepTableComponent } from '../../components/tables/user-rep-table/user-rep-table.component';
|
||||||
import { GroupTableComponent } from '../../components/tables/group-table/group-table.component';
|
import { GroupTableComponent } from '../../components/tables/group-table/group-table.component';
|
||||||
@@ -8,9 +8,12 @@ import Swal from 'sweetalert2';
|
|||||||
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
||||||
import { env } from '../../../environments/environment';
|
import { env } from '../../../environments/environment';
|
||||||
import { BasePageComponent } from '../base-page/base-page.component';
|
import { BasePageComponent } from '../base-page/base-page.component';
|
||||||
import { UserRep } from '../../models/user-management.api.models';
|
import { Group, User, UserRep } from '../../models/user-management.api.models';
|
||||||
import { RepCreateFormComponent } from '../../components/forms/rep-create-form/rep-create-form.component';
|
import { RepCreateFormComponent } from '../../components/forms/rep-create-form/rep-create-form.component';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { BaseTableComponent } from '../../components/tables/base-table/base-table.component';
|
||||||
|
import { GroupService } from '../../services/api/group.service';
|
||||||
|
import { UserService } from '../../services/api/user.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -32,6 +35,20 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
|
|
||||||
private readonly dialog: MatDialog = inject(MatDialog);
|
private readonly dialog: MatDialog = inject(MatDialog);
|
||||||
|
|
||||||
|
rep_row_class: GuiRowClass = {
|
||||||
|
classFunction(source, index) {
|
||||||
|
const now = new Date()
|
||||||
|
|
||||||
|
return (!source.validFrom && !source.validTo)
|
||||||
|
? "current-period-row"
|
||||||
|
: (new Date(source.validFrom) > now)
|
||||||
|
? "future-period-row"
|
||||||
|
: (new Date(source.validTo) < now)
|
||||||
|
? "past-period-row"
|
||||||
|
: "current-period-row";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initWithoutData = () => { }
|
initWithoutData = () => { }
|
||||||
|
|
||||||
constructor(private userRepService: UserRepService) {
|
constructor(private userRepService: UserRepService) {
|
||||||
@@ -46,9 +63,10 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
this.refreshService.removeAll();
|
this.refreshService.removeAll();
|
||||||
this.refreshService.add(() => {
|
this.refreshService.add(() => {
|
||||||
this.users.fetchData();
|
this.users.fetchData();
|
||||||
|
this.groups.fetchData();
|
||||||
this.repUsers.fetchData();
|
this.repUsers.fetchData();
|
||||||
this.repGroups.fetchData();
|
this.repGroups.fetchData();
|
||||||
this.groups.fetchData();
|
this.userReps.fetchData();
|
||||||
})
|
})
|
||||||
this.transferService.add(() => {
|
this.transferService.add(() => {
|
||||||
this.repUsers.safelyUnselectAll();
|
this.repUsers.safelyUnselectAll();
|
||||||
@@ -63,16 +81,22 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
@ViewChild("repGroups") repGroups!: GroupTableComponent;
|
@ViewChild("repGroups") repGroups!: GroupTableComponent;
|
||||||
@ViewChild("userReps") userReps!: UserRepTableComponent;
|
@ViewChild("userReps") userReps!: UserRepTableComponent;
|
||||||
|
|
||||||
|
// user
|
||||||
userOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
userOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
if (rows.length > 0) {
|
if (rows.length > 0) {
|
||||||
this.useRepLabel = `Vertretungen von ${rows[0].source?.username}`
|
this.useRepLabel = `Vertretungen von ${rows[0].source?.username}`
|
||||||
this.users.safelyUnselectAll();
|
//this.users.safelyUnselectAll();
|
||||||
this.userReps.fetchByUser(rows[0].source?.id);
|
this.userReps.fetchByUser(rows[0].source?.id);
|
||||||
this.slGroupId = undefined;
|
this.slGroupId = undefined;
|
||||||
this.slUserId = rows[0].source?.id
|
this.slUserId = rows[0].source?.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userOnClick = (table: BaseTableComponent<User, UserService>) => {
|
||||||
|
this.userOnSelectedRows(table.selectedRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
// group
|
||||||
groupOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
groupOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
if (rows.length > 0) {
|
if (rows.length > 0) {
|
||||||
this.useRepLabel = `Vertretungen von ${rows[0].source?.name}`
|
this.useRepLabel = `Vertretungen von ${rows[0].source?.name}`
|
||||||
@@ -83,6 +107,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
groupOnClick = (table: BaseTableComponent<Group, GroupService>) => {
|
||||||
|
this.groupOnSelectedRows(table.selectedRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
//repUser
|
||||||
repUserOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
repUserOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
if (rows.length == 0 && this.slRepUserId) {
|
if (rows.length == 0 && this.slRepUserId) {
|
||||||
if (!this.slUserId && !this.slGroupId) {
|
if (!this.slUserId && !this.slGroupId) {
|
||||||
@@ -103,9 +132,7 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
var newUserRep: UserRep = {
|
var newUserRep: UserRep = {
|
||||||
userId: this.slUserId,
|
userId: this.slUserId,
|
||||||
groupId: this.slGroupId,
|
groupId: this.slGroupId,
|
||||||
repUserId: this.slRepUserId,
|
repUserId: this.slRepUserId
|
||||||
validFrom: new Date(),
|
|
||||||
validTo: new Date(new Date().setDate(new Date().getDate() + 7))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.openCreateSheet(newUserRep, res => {
|
this.openCreateSheet(newUserRep, res => {
|
||||||
@@ -136,6 +163,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repUserOnClick = (table: BaseTableComponent<User, UserService>) => {
|
||||||
|
this.repUserOnSelectedRows(table.selectedRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
// repGroup
|
||||||
repGroupOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
repGroupOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
if (rows.length == 0 && this.slRepGroupId) {
|
if (rows.length == 0 && this.slRepGroupId) {
|
||||||
if (!this.slUserId && !this.slGroupId) {
|
if (!this.slUserId && !this.slGroupId) {
|
||||||
@@ -186,6 +218,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repGroupOnClick = (table: BaseTableComponent<Group, GroupService>) => {
|
||||||
|
this.repGroupOnSelectedRows(table.selectedRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
// rep events
|
||||||
repOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
repOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
if (rows.length == 0 && this.slRepId) {
|
if (rows.length == 0 && this.slRepId) {
|
||||||
this.userRepService.delete(this.slRepId).subscribe({
|
this.userRepService.delete(this.slRepId).subscribe({
|
||||||
@@ -213,6 +250,10 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repOnClick = (table: BaseTableComponent<UserRep, UserRepService>) => {
|
||||||
|
this.repOnSelectedRows(table.selectedRows);
|
||||||
|
}
|
||||||
|
|
||||||
openCreateSheet(userRep: UserRep, afterCreation: (any: any) => any): void {
|
openCreateSheet(userRep: UserRep, afterCreation: (any: any) => any): void {
|
||||||
|
|
||||||
this.dialog.open(RepCreateFormComponent, {
|
this.dialog.open(RepCreateFormComponent, {
|
||||||
|
|||||||
@@ -165,6 +165,14 @@ export const env = {
|
|||||||
header: "Repr. Benutzer",
|
header: "Repr. Benutzer",
|
||||||
field: (ur: any) => ur.repUser?.username
|
field: (ur: any) => ur.repUser?.username
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
header: "Gültig von",
|
||||||
|
field: (ur: any) => ur.validFrom ? new Date(ur.validFrom).toLocaleDateString('de-DE') : ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: "Gültig bis",
|
||||||
|
field: (ur: any) => ur.validTo ? new Date(ur.validTo).toLocaleDateString('de-DE') : ""
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
config_url: "/assets/config.json",
|
config_url: "/assets/config.json",
|
||||||
|
|||||||
@@ -167,11 +167,11 @@ export const env = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: "Gültig von",
|
header: "Gültig von",
|
||||||
field: (ur: any) => new Date(ur.validFrom).toLocaleDateString('de-DE')
|
field: (ur: any) => ur.validFrom ? new Date(ur.validFrom).toLocaleDateString('de-DE') : ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: "Gültig bis",
|
header: "Gültig bis",
|
||||||
field: (ur: any) => new Date(ur.validTo).toLocaleDateString('de-DE')
|
field: (ur: any) => ur.validTo ? new Date(ur.validTo).toLocaleDateString('de-DE') : ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ code {
|
|||||||
|
|
||||||
.input-row {
|
.input-row {
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-row {
|
.button-row {
|
||||||
@@ -103,3 +104,15 @@ code {
|
|||||||
width: #{$i * 5 + "%"} !important;
|
width: #{$i * 5 + "%"} !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.future-period-row {
|
||||||
|
background: rgba(76, 110, 140, .4) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-period-row {
|
||||||
|
background: rgba(76, 110, 76, .4) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.past-period-row {
|
||||||
|
background: rgba(110, 76, 76, .4) !important;
|
||||||
|
}
|
||||||
@@ -1,117 +1,36 @@
|
|||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using DigitalData.UserManager.Application;
|
|
||||||
using DigitalData.UserManager.Application.DTOs.Auth;
|
using DigitalData.UserManager.Application.DTOs.Auth;
|
||||||
using DigitalData.Core.Abstractions.Application;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using Microsoft.Extensions.Localization;
|
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
using DigitalData.UserManager.Application;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
public class AuthController : ControllerBase
|
||||||
{
|
{
|
||||||
[Route("api/[controller]")]
|
private readonly ILogger<UserController> _logger;
|
||||||
public class AuthController : ControllerBase
|
|
||||||
{
|
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private readonly IGroupOfUserService _gouService;
|
|
||||||
private readonly IDirectorySearchService _dirSearchService;
|
|
||||||
private readonly IStringLocalizer<Resource> _localizer;
|
private readonly IStringLocalizer<Resource> _localizer;
|
||||||
private readonly ILogger<AuthController> _logger;
|
|
||||||
private readonly IConfiguration _config;
|
public AuthController(ILogger<UserController> logger, IUserService userService, IStringLocalizer<Resource> localizer)
|
||||||
public AuthController(IUserService userService, IGroupOfUserService gouService, IDirectorySearchService directorySearchService, IStringLocalizer<Resource> localizer, ILogger<AuthController> logger, IConfiguration configuration)
|
|
||||||
{
|
{
|
||||||
_userService = userService;
|
|
||||||
_gouService = gouService;
|
|
||||||
_dirSearchService = directorySearchService;
|
|
||||||
_localizer = localizer;
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_config = configuration;
|
_userService = userService;
|
||||||
|
_localizer = localizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[Authorize]
|
||||||
[HttpGet("check")]
|
[HttpGet("check")]
|
||||||
public IActionResult CheckAuthentication()
|
public IActionResult CheckAuthentication() => Ok();
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return Ok(User.Identity?.IsAuthenticated ?? false);
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "{Message}", ex.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost("login")]
|
[HttpPost("login")]
|
||||||
public async Task<IActionResult> Login([FromBody] LogInDto login)
|
public Task<IActionResult> Login([FromBody] LogInDto login) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bool isValid = _dirSearchService.ValidateCredentials(login.Username, login.Password);
|
|
||||||
|
|
||||||
if (!isValid)
|
|
||||||
return Unauthorized(Result.Fail().Message(_localizer[Key.UserNotFound]));
|
|
||||||
|
|
||||||
var allowedGroupName = _config.GetSection("AllowedGroupName").Get<string>()
|
|
||||||
?? throw new InvalidOperationException("Allowed group names configuration is missing.");
|
|
||||||
|
|
||||||
var gouMsg = await _gouService.HasGroup(login.Username, allowedGroupName, caseSensitive: false);
|
|
||||||
if (!gouMsg.IsSuccess)
|
|
||||||
return Unauthorized(Result.Fail().Message(_localizer[Key.UnauthorizedUser]));
|
|
||||||
|
|
||||||
//find the user
|
|
||||||
var uRes = await _userService.ReadByUsernameAsync(login.Username);
|
|
||||||
if (!uRes.IsSuccess || uRes.Data is null)
|
|
||||||
{
|
|
||||||
return Unauthorized(uRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
UserReadDto user = uRes.Data;
|
|
||||||
|
|
||||||
// Create claims
|
|
||||||
var claims = new List<Claim>
|
|
||||||
{
|
|
||||||
new (ClaimTypes.NameIdentifier, user.Id.ToString()),
|
|
||||||
new (ClaimTypes.Name, user.Username),
|
|
||||||
new (ClaimTypes.Surname, user.Name ?? ""),
|
|
||||||
new (ClaimTypes.GivenName, user.Prename ?? ""),
|
|
||||||
new (ClaimTypes.Email, user.Email ?? ""),
|
|
||||||
new (ClaimTypes.Role, "PM_USER")
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create claimsIdentity
|
|
||||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
|
||||||
|
|
||||||
// Create authProperties
|
|
||||||
var authProperties = new AuthenticationProperties
|
|
||||||
{
|
|
||||||
IsPersistent = true,
|
|
||||||
AllowRefresh = true,
|
|
||||||
ExpiresUtc = DateTime.UtcNow.AddMinutes(60)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Sign in
|
|
||||||
await HttpContext.SignInAsync(
|
|
||||||
CookieAuthenticationDefaults.AuthenticationScheme,
|
|
||||||
new ClaimsPrincipal(claimsIdentity),
|
|
||||||
authProperties);
|
|
||||||
|
|
||||||
_dirSearchService.SetSearchRootCache(user.Username, login.Password);
|
|
||||||
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "{Message}", ex.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpGet("user")]
|
[HttpGet("user")]
|
||||||
@@ -141,18 +60,13 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[HttpPost("logout")]
|
[HttpPost("logout")]
|
||||||
public async Task<IActionResult> Logout()
|
public IActionResult Logout()
|
||||||
{
|
{
|
||||||
try
|
Response.Cookies.Delete("AuthToken", new()
|
||||||
{
|
{
|
||||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
Path = "/"
|
||||||
|
});
|
||||||
|
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "{Message}", ex.Message);
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -7,16 +7,16 @@ using DigitalData.UserManager.Domain.Entities;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
{
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class BaseAuthController<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TBaseEntity> : CRUDControllerBaseWithErrorHandling<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TBaseEntity, int>
|
public class BaseAuthController<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TBaseEntity> : CRUDControllerBaseWithErrorHandling<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TBaseEntity, int>
|
||||||
where TCRUDService : IBaseService<TCreateDto, TReadDto, TUpdateDto, TBaseEntity>
|
where TCRUDService : IBaseService<TCreateDto, TReadDto, TBaseEntity>
|
||||||
where TCreateDto : BaseCreateDto
|
where TCreateDto : BaseCreateDto
|
||||||
where TReadDto : class
|
where TReadDto : class
|
||||||
where TUpdateDto : BaseUpdateDto
|
where TUpdateDto : BaseUpdateDto
|
||||||
where TBaseEntity : BaseEntity
|
where TBaseEntity : BaseEntity
|
||||||
{
|
{
|
||||||
private readonly Lazy<int?> _lUserId;
|
private readonly Lazy<int?> _lUserId;
|
||||||
|
|
||||||
public BaseAuthController(ILogger logger, TCRUDService service, IUserService userService) : base(logger, service)
|
public BaseAuthController(ILogger logger, TCRUDService service, IUserService userService) : base(logger, service)
|
||||||
@@ -43,5 +43,4 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
: null;
|
: null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -10,13 +10,13 @@ using Microsoft.Extensions.Localization;
|
|||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "<Pending>")]
|
||||||
|
[Authorize]
|
||||||
|
public class DirectoryController : ControllerBase
|
||||||
{
|
{
|
||||||
[Route("api/[controller]")]
|
|
||||||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "<Pending>")]
|
|
||||||
[Authorize]
|
|
||||||
public class DirectoryController : ControllerBase
|
|
||||||
{
|
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private readonly IDirectorySearchService _dirSearchService;
|
private readonly IDirectorySearchService _dirSearchService;
|
||||||
private readonly Dictionary<string, string> _customSearchFilters;
|
private readonly Dictionary<string, string> _customSearchFilters;
|
||||||
@@ -231,5 +231,4 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
get => (HttpContext.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value);
|
get => (HttpContext.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name)?.Value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
using DigitalData.UserManager.Application.Services;
|
using DigitalData.UserManager.Application.Services;
|
||||||
using DigitalData.UserManager.Application.Services.Options;
|
using DigitalData.UserManager.Application.Services.Options;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
public class EncryptionController : ControllerBase
|
||||||
{
|
{
|
||||||
[Route("api/[controller]")]
|
|
||||||
[ApiController]
|
|
||||||
public class EncryptionController : ControllerBase
|
|
||||||
{
|
|
||||||
private readonly Encryptor _encryptor;
|
private readonly Encryptor _encryptor;
|
||||||
|
|
||||||
public EncryptionController(Encryptor encryptor)
|
public EncryptionController(Encryptor encryptor)
|
||||||
@@ -42,5 +41,4 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
var param = Encryptor.GenerateParameters();
|
var param = Encryptor.GenerateParameters();
|
||||||
return Ok(param);
|
return Ok(param);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -5,11 +5,11 @@ using DigitalData.UserManager.Domain.Entities;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
public class GroupController : BaseAuthController<IGroupService, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group>
|
||||||
{
|
{
|
||||||
[Authorize]
|
|
||||||
public class GroupController : BaseAuthController<IGroupService, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group>
|
|
||||||
{
|
|
||||||
public GroupController(ILogger<GroupController> logger, IGroupService service, IUserService userService) : base(logger, service, userService)
|
public GroupController(ILogger<GroupController> logger, IGroupService service, IUserService userService) : base(logger, service, userService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -39,5 +39,4 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -5,11 +5,11 @@ using DigitalData.UserManager.Domain.Entities;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
public class GroupOfUserController : BaseAuthController<IGroupOfUserService, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser>
|
||||||
{
|
{
|
||||||
[Authorize]
|
|
||||||
public class GroupOfUserController : BaseAuthController<IGroupOfUserService, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser>
|
|
||||||
{
|
|
||||||
public GroupOfUserController(ILogger<GroupOfUserController> logger, IGroupOfUserService service, IUserService userService) : base(logger, service, userService)
|
public GroupOfUserController(ILogger<GroupOfUserController> logger, IGroupOfUserService service, IUserService userService) : base(logger, service, userService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -77,5 +77,4 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,12 @@ using DigitalData.UserManager.Application.DTOs.Module;
|
|||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
public class ModuleController : ReadControllerBaseWithErrorHandling<IModuleService, ModuleDto, Module, int>
|
||||||
{
|
{
|
||||||
[Authorize]
|
|
||||||
public class ModuleController : ReadControllerBaseWithErrorHandling<IModuleService, ModuleDto, Module, int>
|
|
||||||
{
|
|
||||||
public ModuleController(ILogger<ModuleController> logger, IModuleService service) : base(logger, service)
|
public ModuleController(ILogger<ModuleController> logger, IModuleService service) : base(logger, service)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,11 @@ using DigitalData.UserManager.Domain.Entities;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
public class ModuleOfUserController : CRUDControllerBaseWithErrorHandling<IModuleOfUserService, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>
|
||||||
{
|
{
|
||||||
[Authorize]
|
|
||||||
public class ModuleOfUserController : CRUDControllerBaseWithErrorHandling<IModuleOfUserService, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>
|
|
||||||
{
|
|
||||||
public ModuleOfUserController(ILogger<ModuleOfUserController> logger, IModuleOfUserService service) : base(logger, service)
|
public ModuleOfUserController(ILogger<ModuleOfUserController> logger, IModuleOfUserService service) : base(logger, service)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -49,5 +49,4 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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.User;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
@@ -6,11 +5,11 @@ using DigitalData.UserManager.Domain.Entities;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
public class UserController : BaseAuthController<IUserService, UserCreateDto, UserReadDto, UserUpdateDto, User>
|
||||||
{
|
{
|
||||||
[Authorize]
|
|
||||||
public class UserController : BaseAuthController<IUserService, UserCreateDto, UserReadDto, UserUpdateDto, User>
|
|
||||||
{
|
|
||||||
public UserController(ILogger<UserController> logger, IUserService service) : base(logger, service, service)
|
public UserController(ILogger<UserController> logger, IUserService service) : base(logger, service, service)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -96,5 +95,4 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -5,11 +5,11 @@ using DigitalData.UserManager.Domain.Entities;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.API.Controllers
|
namespace DigitalData.UserManager.API.Controllers;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
public class UserRepController : BaseAuthController<IUserRepService, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep>
|
||||||
{
|
{
|
||||||
[Authorize]
|
|
||||||
public class UserRepController : BaseAuthController<IUserRepService, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep>
|
|
||||||
{
|
|
||||||
public UserRepController(ILogger<UserRepController> logger, IUserRepService service, IUserService userService) : base(logger, service, userService)
|
public UserRepController(ILogger<UserRepController> logger, IUserRepService service, IUserService userService) : base(logger, service, userService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -38,5 +38,4 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,66 +1,40 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Version>3.0.0.0</Version>
|
<Version>6.0.1</Version>
|
||||||
<AssemblyVersion>3.0.0.0</AssemblyVersion>
|
<AssemblyVersion>6.0.1</AssemblyVersion>
|
||||||
<FileVersion>3.0.0.0</FileVersion>
|
<FileVersion>6.0.1</FileVersion>
|
||||||
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Remove="wwwroot\assets\img\DD_white.svg" />
|
|
||||||
<Content Remove="wwwroot\assets\img\digital_data.svg" />
|
|
||||||
<Content Remove="wwwroot\assets\img\digital_data_red_BG.svg" />
|
|
||||||
<Content Remove="wwwroot\assets\img\group.svg" />
|
|
||||||
<Content Remove="wwwroot\assets\img\Huhn_andersrum.webp" />
|
|
||||||
<Content Remove="wwwroot\assets\img\login_logo.svg" />
|
|
||||||
<Content Remove="wwwroot\assets\img\mode_logo.svg" />
|
|
||||||
<Content Remove="wwwroot\assets\img\thema_bttn.svg" />
|
|
||||||
<Content Remove="wwwroot\assets\img\user-plus-svgrepo-com.svg" />
|
|
||||||
<Content Remove="wwwroot\assets\img\user.svg" />
|
|
||||||
<Content Remove="wwwroot\chunk-A2L6DXQH.js" />
|
<Content Remove="wwwroot\chunk-A2L6DXQH.js" />
|
||||||
<Content Remove="wwwroot\chunk-ZC35XWOR.js" />
|
<Content Remove="wwwroot\chunk-ZC35XWOR.js" />
|
||||||
<Content Remove="wwwroot\favicon.ico" />
|
|
||||||
<Content Remove="wwwroot\group-table\index.html" />
|
|
||||||
<Content Remove="wwwroot\index.html" />
|
|
||||||
<Content Remove="wwwroot\main-QF3MRK45.js" />
|
<Content Remove="wwwroot\main-QF3MRK45.js" />
|
||||||
<Content Remove="wwwroot\media\bootstrap-icons-OCU552PF.woff" />
|
|
||||||
<Content Remove="wwwroot\media\bootstrap-icons-X6UQXWUS.woff2" />
|
|
||||||
<Content Remove="wwwroot\module-table\index.html" />
|
|
||||||
<Content Remove="wwwroot\polyfills-6EAL64PA.js" />
|
|
||||||
<Content Remove="wwwroot\scripts-EEEIPNC3.js" />
|
|
||||||
<Content Remove="wwwroot\styles-ZC4KW2NT.css" />
|
|
||||||
<Content Remove="wwwroot\user-assignment\index.html" />
|
|
||||||
<Content Remove="wwwroot\user-representation\index.html" />
|
|
||||||
<Content Remove="wwwroot\user-table\index.html" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DigitalData.Core.API" Version="2.0.0" />
|
<Content Include="wwwroot\assets\img\.vscode\settings.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DigitalData.Auth.Client" Version="1.3.5" />
|
||||||
|
<PackageReference Include="DigitalData.Core.API" Version="2.1.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.20" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.20" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.15" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.15" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="7.0.1" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="NLog" Version="5.3.2" />
|
<PackageReference Include="NLog" Version="5.3.2" />
|
||||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.11" />
|
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.11" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
|
|
||||||
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.1" />
|
|
||||||
<PackageReference Include="System.DirectoryServices.Protocols" Version="7.0.1" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\DigitalData.UserManager.Application\DigitalData.UserManager.Application.csproj" />
|
|
||||||
<ProjectReference Include="..\DigitalData.UserManager.Domain\DigitalData.UserManager.Domain.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -68,6 +42,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="..\Assets\icon.png">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath>\</PackagePath>
|
||||||
|
</None>
|
||||||
<None Include="wwwroot\assets\img\DD_white.svg" />
|
<None Include="wwwroot\assets\img\DD_white.svg" />
|
||||||
<None Include="wwwroot\assets\img\digital_data.svg" />
|
<None Include="wwwroot\assets\img\digital_data.svg" />
|
||||||
<None Include="wwwroot\assets\img\digital_data_red_BG.svg" />
|
<None Include="wwwroot\assets\img\digital_data_red_BG.svg" />
|
||||||
@@ -78,24 +56,11 @@
|
|||||||
<None Include="wwwroot\assets\img\thema_bttn.svg" />
|
<None Include="wwwroot\assets\img\thema_bttn.svg" />
|
||||||
<None Include="wwwroot\assets\img\user-plus-svgrepo-com.svg" />
|
<None Include="wwwroot\assets\img\user-plus-svgrepo-com.svg" />
|
||||||
<None Include="wwwroot\assets\img\user.svg" />
|
<None Include="wwwroot\assets\img\user.svg" />
|
||||||
<None Include="wwwroot\favicon.ico" />
|
|
||||||
<None Include="wwwroot\group-table\index.html" />
|
|
||||||
<None Include="wwwroot\index.html" />
|
|
||||||
<None Include="wwwroot\media\bootstrap-icons-OCU552PF.woff" />
|
|
||||||
<None Include="wwwroot\media\bootstrap-icons-X6UQXWUS.woff2" />
|
<None Include="wwwroot\media\bootstrap-icons-X6UQXWUS.woff2" />
|
||||||
<None Include="wwwroot\module-table\index.html" />
|
|
||||||
<None Include="wwwroot\polyfills-6EAL64PA.js" />
|
|
||||||
<None Include="wwwroot\scripts-EEEIPNC3.js" />
|
|
||||||
<None Include="wwwroot\styles-ZC4KW2NT.css" />
|
|
||||||
<None Include="wwwroot\user-assignment\index.html" />
|
|
||||||
<None Include="wwwroot\user-representation\index.html" />
|
|
||||||
<None Include="wwwroot\user-table\index.html" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Update="wwwroot\assets\config.json">
|
<ProjectReference Include="..\DigitalData.UserManager.DependencyInjection\DigitalData.UserManager.DependencyInjection.csproj" />
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
18
DigitalData.UserManager.API/LazyServiceProvider.cs
Normal file
18
DigitalData.UserManager.API/LazyServiceProvider.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
namespace DigitalData.UserManager.API;
|
||||||
|
|
||||||
|
public class LazyServiceProvider : IServiceProvider
|
||||||
|
{
|
||||||
|
private Lazy<IServiceProvider>? _serviceProvider;
|
||||||
|
|
||||||
|
public Func<IServiceProvider> Factory
|
||||||
|
{
|
||||||
|
set => _serviceProvider = new(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? GetService(Type serviceType)
|
||||||
|
{
|
||||||
|
if (_serviceProvider is null)
|
||||||
|
throw new InvalidOperationException("GetService cannot be called before _serviceProvider is set.");
|
||||||
|
return _serviceProvider.Value.GetService(serviceType);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
DigitalData.UserManager.API/Models/AuthTokenKeys.cs
Normal file
12
DigitalData.UserManager.API/Models/AuthTokenKeys.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace DigitalData.UserManager.API.Models;
|
||||||
|
|
||||||
|
public class AuthTokenKeys
|
||||||
|
{
|
||||||
|
public string Cookie { get; init; } = "AuthToken";
|
||||||
|
|
||||||
|
public string QueryString { get; init; } = "AuthToken";
|
||||||
|
|
||||||
|
public string Issuer { get; init; } = "auth.digitaldata.works";
|
||||||
|
|
||||||
|
public string Audience { get; init; } = "user-manager.digitaldata.works";
|
||||||
|
}
|
||||||
18
DigitalData.UserManager.API/Models/ModelExtensions.cs
Normal file
18
DigitalData.UserManager.API/Models/ModelExtensions.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.API.Models;
|
||||||
|
|
||||||
|
public static class ModelExtensions
|
||||||
|
{
|
||||||
|
public static List<Claim> ToClaimList(this UserReadDto user) => new()
|
||||||
|
{
|
||||||
|
new (ClaimTypes.NameIdentifier, user.Id.ToString()),
|
||||||
|
new (ClaimTypes.Name, user.Username),
|
||||||
|
new (ClaimTypes.Surname, user.Name ?? ""),
|
||||||
|
new (ClaimTypes.GivenName, user.Prename ?? ""),
|
||||||
|
new (ClaimTypes.Email, user.Email ?? "")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static Dictionary<string, object> ToClaimDictionary(this UserReadDto user) => user.ToClaimList().ToDictionary(claim => claim.Type, claim => (object)claim.Value);
|
||||||
|
}
|
||||||
@@ -10,20 +10,27 @@ using DigitalData.UserManager.API.Controllers;
|
|||||||
using DigitalData.UserManager.Application.Services;
|
using DigitalData.UserManager.Application.Services;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
using DigitalData.UserManager.API.Models;
|
||||||
|
using DigitalData.Auth.Client;
|
||||||
|
using DigitalData.UserManager.API;
|
||||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using DigitalData.Core.Abstractions.Security.Extensions;
|
||||||
|
using Microsoft.OpenApi.Models;
|
||||||
|
using DigitalData.UserManager.DependencyInjection;
|
||||||
|
|
||||||
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
||||||
logger.Debug("init main");
|
logger.Debug("init main");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder();
|
||||||
|
|
||||||
var config = builder.Configuration;
|
var config = builder.Configuration;
|
||||||
|
|
||||||
builder.Services.AddEncryptor(builder.Configuration.GetSection("EncryptionParameters"));
|
builder.Services.AddEncryptor(builder.Configuration.GetSection("EncryptionParameters"));
|
||||||
|
|
||||||
if (builder.Configuration.GetValue<bool>("RunAsWindowsService"))
|
|
||||||
builder.Host.UseWindowsService();
|
|
||||||
|
|
||||||
builder.Logging.ClearProviders();
|
builder.Logging.ClearProviders();
|
||||||
builder.Host.UseNLog();
|
builder.Host.UseNLog();
|
||||||
|
|
||||||
@@ -34,7 +41,7 @@ try {
|
|||||||
.AndIf(c => !config.GetValue<bool>("UseEncryptor")));
|
.AndIf(c => !config.GetValue<bool>("UseEncryptor")));
|
||||||
}).AddNewtonsoftJson(options =>
|
}).AddNewtonsoftJson(options =>
|
||||||
{
|
{
|
||||||
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
|
options.SerializerSettings.DateTimeZoneHandling = config.GetValue<DateTimeZoneHandling>("DateTimeZoneHandling");
|
||||||
});
|
});
|
||||||
|
|
||||||
if (builder.Configuration.GetValue<bool>("UseSwagger"))
|
if (builder.Configuration.GetValue<bool>("UseSwagger"))
|
||||||
@@ -63,7 +70,7 @@ try {
|
|||||||
// Once the app is built, the password will be decrypted with Encryptor. lazy loading also acts as a call back method.
|
// Once the app is built, the password will be decrypted with Encryptor. lazy loading also acts as a call back method.
|
||||||
Lazy<string>? cnn_str = null;
|
Lazy<string>? cnn_str = null;
|
||||||
|
|
||||||
builder.Services.AddDbContext<UserManagerDbContext>(options => options.UseSqlServer(cnn_str!.Value).EnableSensitiveDataLogging());
|
builder.Services.AddUserManager(options => options.UseSqlServer(cnn_str!.Value).EnableSensitiveDataLogging());
|
||||||
|
|
||||||
var allowedOrigins = builder.Configuration.GetSection("AllowedOrigins").Get<string[]>() ?? throw new InvalidOperationException("In appsettings there is no allowed origin.");
|
var allowedOrigins = builder.Configuration.GetSection("AllowedOrigins").Get<string[]>() ?? throw new InvalidOperationException("In appsettings there is no allowed origin.");
|
||||||
|
|
||||||
@@ -79,16 +86,92 @@ try {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//builder.Services.AddAutoMapper(typeof(DirectoryMappingProfile).Assembly);
|
|
||||||
builder.Services.AddUserManager<UserManagerDbContext>();
|
|
||||||
|
|
||||||
builder.ConfigureBySection<DirectorySearchOptions>();
|
builder.ConfigureBySection<DirectorySearchOptions>();
|
||||||
builder.Services.AddDirectorySearchService();
|
builder.Services.AddDirectorySearchService(config.GetSection("DirectorySearchOptions"));
|
||||||
|
builder.Services.AddJWTService<UserReadDto>(user => new SecurityTokenDescriptor()
|
||||||
|
{
|
||||||
|
Claims = user.ToClaimList().ToDictionary(claim => claim.Type, claim => claim.Value as object)
|
||||||
|
});
|
||||||
|
|
||||||
|
var lazyProvider = new LazyServiceProvider();
|
||||||
|
|
||||||
|
builder.Services.AddAuthHubClient(config.GetSection("AuthClientParams"));
|
||||||
|
|
||||||
|
var authTokenKeys = config.GetSection(nameof(AuthTokenKeys)).Get<AuthTokenKeys>() ?? new();
|
||||||
|
|
||||||
|
builder.Services
|
||||||
|
.AddAuthentication(options =>
|
||||||
|
{
|
||||||
|
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
|
})
|
||||||
|
.AddJwtBearer(opt =>
|
||||||
|
{
|
||||||
|
opt.TokenValidationParameters = new TokenValidationParameters
|
||||||
|
{
|
||||||
|
ValidateIssuerSigningKey = true,
|
||||||
|
IssuerSigningKeyResolver = (token, securityToken, identifier, parameters) =>
|
||||||
|
{
|
||||||
|
var clientParams = lazyProvider.GetRequiredService<IOptions<ClientParams>>()?.Value;
|
||||||
|
var publicKey = clientParams!.PublicKeys.Get(authTokenKeys.Issuer, authTokenKeys.Audience);
|
||||||
|
return new List<SecurityKey>() { publicKey.SecurityKey };
|
||||||
|
},
|
||||||
|
ValidateIssuer = true,
|
||||||
|
ValidIssuer = authTokenKeys.Issuer,
|
||||||
|
ValidateAudience = true,
|
||||||
|
ValidAudience = authTokenKeys.Audience,
|
||||||
|
};
|
||||||
|
|
||||||
|
opt.Events = new JwtBearerEvents
|
||||||
|
{
|
||||||
|
OnMessageReceived = context =>
|
||||||
|
{
|
||||||
|
// if there is no token read related cookie or query string
|
||||||
|
if (context.Token is null) // if there is no token
|
||||||
|
{
|
||||||
|
if (context.Request.Cookies.TryGetValue(authTokenKeys.Cookie, out var cookieToken) && cookieToken is not null)
|
||||||
|
context.Token = cookieToken;
|
||||||
|
else if (context.Request.Query.TryGetValue(authTokenKeys.QueryString, out var queryStrToken))
|
||||||
|
context.Token = queryStrToken;
|
||||||
|
}
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddSwaggerGen(setupAct =>
|
||||||
|
{
|
||||||
|
setupAct.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Description = "JWT Authorization header using the Bearer scheme. Example: \"Bearer {token}\"",
|
||||||
|
Name = "Authorization",
|
||||||
|
In = ParameterLocation.Header,
|
||||||
|
Type = SecuritySchemeType.Http,
|
||||||
|
Scheme = "Bearer"
|
||||||
|
});
|
||||||
|
|
||||||
|
setupAct.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||||
|
{
|
||||||
|
{
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Reference = new OpenApiReference
|
||||||
|
{
|
||||||
|
Type = ReferenceType.SecurityScheme,
|
||||||
|
Id = "Bearer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Array.Empty<string>()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddCookieBasedLocalizer();
|
builder.Services.AddCookieBasedLocalizer();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
lazyProvider.Factory = () => app.Services;
|
||||||
|
|
||||||
cnn_str = new(() =>
|
cnn_str = new(() =>
|
||||||
{
|
{
|
||||||
var encryptor = app.Services.GetRequiredService<Encryptor>();
|
var encryptor = app.Services.GetRequiredService<Encryptor>();
|
||||||
|
|||||||
@@ -11,9 +11,12 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||||
<ProjectGuid>07ccd651-647c-49f7-9715-30cebc13710d</ProjectGuid>
|
<ProjectGuid>07ccd651-647c-49f7-9715-30cebc13710d</ProjectGuid>
|
||||||
<DesktopBuildPackageLocation>P:\Install .Net\0 DD - Smart UP\DD-UserManager\Web\${Version}\$(Version).zip</DesktopBuildPackageLocation>
|
<DesktopBuildPackageLocation>P:\Install .Net\0 DD - Smart UP\DD-UserManager\Web\$(Version)\$(Version).zip</DesktopBuildPackageLocation>
|
||||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||||
<DeployIisAppPath>UserManager.API</DeployIisAppPath>
|
<DeployIisAppPath>UserManager.API</DeployIisAppPath>
|
||||||
<_TargetId>IISWebDeployPackage</_TargetId>
|
<_TargetId>IISWebDeployPackage</_TargetId>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
|
||||||
-->
|
|
||||||
<Project>
|
|
||||||
<PropertyGroup>
|
|
||||||
<WebPublishMethod>Package</WebPublishMethod>
|
|
||||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
|
||||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
|
||||||
<SiteUrlToLaunchAfterPublish />
|
|
||||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
|
||||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
|
||||||
<ProjectGuid>07ccd651-647c-49f7-9715-30cebc13710d</ProjectGuid>
|
|
||||||
<DesktopBuildPackageLocation>E:\TekH\Visual Studio\src\DigitalData.UserManager.API.zip</DesktopBuildPackageLocation>
|
|
||||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
|
||||||
<DeployIisAppPath>UserManager</DeployIisAppPath>
|
|
||||||
<_TargetId>IISWebDeployPackage</_TargetId>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"https": {
|
"https": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": false,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "https://localhost:7103;http://localhost:5137",
|
"applicationUrl": "https://localhost:7103;http://localhost:5137",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
|
|||||||
@@ -72,7 +72,19 @@
|
|||||||
"IV": "gMuetIjlPvJnSzu+i7I3xg=="
|
"IV": "gMuetIjlPvJnSzu+i7I3xg=="
|
||||||
},
|
},
|
||||||
"AllowedGroupName": "UM_ADMINS",
|
"AllowedGroupName": "UM_ADMINS",
|
||||||
|
"DateTimeZoneHandling": "Local",
|
||||||
// Delete below in production
|
// Delete below in production
|
||||||
"UseEncryptor": true,
|
"UseEncryptor": true,
|
||||||
"UseSwagger": true
|
"UseSwagger": true,
|
||||||
|
"AuthClientParams": {
|
||||||
|
"Url": "https://localhost:7192/auth-hub",
|
||||||
|
"PublicKeys": [
|
||||||
|
{
|
||||||
|
"Issuer": "auth.digitaldata.works",
|
||||||
|
"Audience": "user-manager.digitaldata.works",
|
||||||
|
"Content": "-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3QCd7dH/xOUITFZbitMa/xnh8a0LyL6ZBvSRAwkI9ceplTRSHJXoM1oB+xtjWE1kOuHVLe941Tm03szS4+/rHIm0Ejva/KKlv7sPFAHE/pWuoPS303vOHgI4HAFcuwywA8CghUWzaaK5LU/Hl8srWwxBHv5hKIUjJFJygeAIENvFOZ1gFbB3MPEC99PiPOwAmfl4tMQUmSsFyspl/RWVi7bTv26ZE+m3KPcWppmvmYjXlSitxRaySxnfFvpca/qWfd/uUUg2KWKtpAwWVkqr0qD9v3TyKSgHoGDsrFpwSx8qufUJSinmZ1u/0iKl6TXeHubYS4C4SUSVjOWXymI2ZQIDAQAB-----END PUBLIC KEY-----"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"RetryDelay": "00:00:05"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
7
DigitalData.UserManager.API/wwwroot/chunk-BERTLP66.js
Normal file
7
DigitalData.UserManager.API/wwwroot/chunk-BERTLP66.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
164
DigitalData.UserManager.API/wwwroot/main-UKQG27PC.js
Normal file
164
DigitalData.UserManager.API/wwwroot/main-UKQG27PC.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -5,10 +5,9 @@ using DigitalData.UserManager.Application.DTOs.Base;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IBaseService<TCreateDto, TReadDto, TUpdateDto, TBaseEntity> : ICRUDService<TCreateDto, TReadDto, TUpdateDto, TBaseEntity, int>
|
public interface IBaseService<TCreateDto, TReadDto, TBaseEntity> : ICRUDService<TCreateDto, TReadDto, TBaseEntity, int>
|
||||||
where TCreateDto : BaseCreateDto
|
where TCreateDto : BaseCreateDto
|
||||||
where TReadDto : class
|
where TReadDto : class
|
||||||
where TUpdateDto : BaseUpdateDto
|
|
||||||
where TBaseEntity : BaseEntity
|
where TBaseEntity : BaseEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using DigitalData.Core.DTO;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IGroupOfUserService : IBaseService<GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser>
|
public interface IGroupOfUserService : IBaseService<GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUser>
|
||||||
{
|
{
|
||||||
Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId);
|
Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using DigitalData.Core.DTO;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IGroupService : IBaseService<GroupCreateDto, GroupReadDto, GroupUpdateDto, Group>
|
public interface IGroupService : IBaseService<GroupCreateDto, GroupReadDto, Group>
|
||||||
{
|
{
|
||||||
Task<DataResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
Task<DataResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using DigitalData.UserManager.Domain.Entities;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IModuleOfUserService : ICRUDService<ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>
|
public interface IModuleOfUserService : ICRUDService<ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUser, int>
|
||||||
{
|
{
|
||||||
Task<Result> DeleteAsyncByModuleUserId(int moduleId, int userId);
|
Task<Result> DeleteAsyncByModuleUserId(int moduleId, int userId);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using DigitalData.Core.DTO;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IUserRepService : IBaseService<UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep>
|
public interface IUserRepService : IBaseService<UserRepCreateDto, UserRepReadDto, UserRep>
|
||||||
{
|
{
|
||||||
Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null);
|
Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using DigitalData.Core.DTO;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Contracts
|
namespace DigitalData.UserManager.Application.Contracts
|
||||||
{
|
{
|
||||||
public interface IUserService : IBaseService<UserCreateDto, UserReadDto, UserUpdateDto, User>
|
public interface IUserService : IBaseService<UserCreateDto, UserReadDto, User>
|
||||||
{
|
{
|
||||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IClientUserRepository : ICRUDRepository<ClientUser, int>
|
||||||
|
{
|
||||||
|
Task<IEnumerable<ClientUser>> ReadAsync(bool readOnly = true, int? userId = null);
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IGroupOfUserRepository : ICRUDRepository<GroupOfUser, int>
|
||||||
|
{
|
||||||
|
IQueryable<GroupOfUser> ReadByGroupId(int groupId);
|
||||||
|
|
||||||
|
Task<IEnumerable<GroupOfUser>> ReadByGroupUserIdAsync(int groupId, int userId);
|
||||||
|
|
||||||
|
Task<IEnumerable<GroupOfUser>> ReadAllAsyncWithGroup();
|
||||||
|
|
||||||
|
Task<IEnumerable<GroupOfUser>> ReadAllAsyncWithUser();
|
||||||
|
|
||||||
|
Task<IEnumerable<GroupOfUser>> ReadAllAsyncWithGroupAndUser();
|
||||||
|
|
||||||
|
Task<IEnumerable<GroupOfUser>> ReadByUsernameAsync(string username);
|
||||||
|
|
||||||
|
Task<IEnumerable<GroupOfUser>> ReadByUserIdAsync(int userId);
|
||||||
|
|
||||||
|
// merge all GroupOfUserRepository-methods conditionally under this method
|
||||||
|
Task<IEnumerable<GroupOfUser>> ReadAsync(
|
||||||
|
bool readOnly = true,
|
||||||
|
bool withGroup = true, bool withUser = true,
|
||||||
|
int? id = null, int? groupId = null, int? userId = null, string? username = null);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IGroupRepository : ICRUDRepository<Group, int>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IModuleOfUserRepository : ICRUDRepository<ModuleOfUser, int>
|
||||||
|
{
|
||||||
|
IQueryable<ModuleOfUser> ReadByModuleId(int moduleId);
|
||||||
|
|
||||||
|
Task<IEnumerable<ModuleOfUser>> ReadByModelUserIdAsync(int moduleId, int userId);
|
||||||
|
|
||||||
|
Task<IEnumerable<ModuleOfUser>> ReadByUserAsync(string username);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IModuleRepository : ICRUDRepository<Module, int>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IUserRepRepository : ICRUDRepository<UserRep, int>
|
||||||
|
{
|
||||||
|
Task<IEnumerable<UserRep>> ReadAllAsync(
|
||||||
|
bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false,
|
||||||
|
int? userId = null, int? repUserId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true);
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using DigitalData.Core.Abstractions.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
|
public interface IUserRepository : ICRUDRepository<User, int>
|
||||||
|
{
|
||||||
|
Task<IEnumerable<User>> ReadByModuleIdAsync(int moduleId);
|
||||||
|
|
||||||
|
Task<IEnumerable<User>> ReadUnassignedByModuleIdAsync(int moduleId);
|
||||||
|
|
||||||
|
Task<IEnumerable<User>> ReadByGroupIdAsync(int groupId);
|
||||||
|
|
||||||
|
Task<IEnumerable<User>> ReadUnassignedByGroupIdAsync(int groupId);
|
||||||
|
|
||||||
|
Task<User?> ReadByUsernameAsync(string username);
|
||||||
|
}
|
||||||
@@ -2,9 +2,6 @@
|
|||||||
using DigitalData.UserManager.Application.MappingProfiles;
|
using DigitalData.UserManager.Application.MappingProfiles;
|
||||||
using DigitalData.UserManager.Application.Services;
|
using DigitalData.UserManager.Application.Services;
|
||||||
using DigitalData.UserManager.Application.Services.Options;
|
using DigitalData.UserManager.Application.Services.Options;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
|
||||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
@@ -19,8 +16,7 @@ namespace DigitalData.UserManager.Application
|
|||||||
/// <typeparam name="TDbContext">The type of the DbContext to use for the repositories.</typeparam>
|
/// <typeparam name="TDbContext">The type of the DbContext to use for the repositories.</typeparam>
|
||||||
/// <param name="services">The IServiceCollection to which the services will be added.</param>
|
/// <param name="services">The IServiceCollection to which the services will be added.</param>
|
||||||
/// <returns>The updated IServiceCollection.</returns>
|
/// <returns>The updated IServiceCollection.</returns>
|
||||||
public static IServiceCollection AddUserManager<TDbContext>(this IServiceCollection services)
|
public static IServiceCollection AddUserManagerApplication(this IServiceCollection services)
|
||||||
where TDbContext : DbContext, IUserManagerDbContext
|
|
||||||
=> services
|
=> services
|
||||||
.AddAutoMapper(typeof(UserMappingProfile).Assembly)
|
.AddAutoMapper(typeof(UserMappingProfile).Assembly)
|
||||||
.AddAutoMapper(typeof(GroupMappingProfile).Assembly)
|
.AddAutoMapper(typeof(GroupMappingProfile).Assembly)
|
||||||
@@ -29,14 +25,6 @@ namespace DigitalData.UserManager.Application
|
|||||||
.AddAutoMapper(typeof(ModuleOfUserMappingProfile).Assembly)
|
.AddAutoMapper(typeof(ModuleOfUserMappingProfile).Assembly)
|
||||||
.AddAutoMapper(typeof(UserRepMappingProfile).Assembly)
|
.AddAutoMapper(typeof(UserRepMappingProfile).Assembly)
|
||||||
|
|
||||||
.AddScoped<IUserRepository, UserRepository<TDbContext>>()
|
|
||||||
.AddScoped<IGroupRepository, GroupRepository<TDbContext>>()
|
|
||||||
.AddScoped<IGroupOfUserRepository, GroupOfUserRepository<TDbContext>>()
|
|
||||||
.AddScoped<IModuleRepository, ModuleRepository<TDbContext>>()
|
|
||||||
.AddScoped<IModuleOfUserRepository, ModuleOfUserRepository<TDbContext>>()
|
|
||||||
.AddScoped<IUserRepRepository, UserRepRepository<TDbContext>>()
|
|
||||||
.AddScoped<IClientUserRepository, ClientUserRepository<TDbContext>>()
|
|
||||||
|
|
||||||
.AddScoped<IUserService, UserService>()
|
.AddScoped<IUserService, UserService>()
|
||||||
.AddScoped<IGroupService, GroupService>()
|
.AddScoped<IGroupService, GroupService>()
|
||||||
.AddScoped<IGroupOfUserService, GroupOfUserService>()
|
.AddScoped<IGroupOfUserService, GroupOfUserService>()
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>UserManager.Application</PackageId>
|
<PackageId>UserManager.Application</PackageId>
|
||||||
<Version>2.0.0.0</Version>
|
<Version>3.1.3</Version>
|
||||||
<Authors>Digital Data GmbH</Authors>
|
<Authors>Digital Data GmbH</Authors>
|
||||||
<Company>Digital Data GmbH</Company>
|
<Company>Digital Data GmbH</Company>
|
||||||
<Product>UserManager.Application</Product>
|
<Product>UserManager.Application</Product>
|
||||||
@@ -14,19 +14,26 @@
|
|||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||||
<PackageTags>digital data application user maanger</PackageTags>
|
<PackageTags>digital data application user maanger</PackageTags>
|
||||||
|
<AssemblyVersion>3.1.3</AssemblyVersion>
|
||||||
|
<FileVersion>3.1.3</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\DigitalData.UserManager.Domain\Assets\icon.png">
|
<None Include="..\Assets\icon.png">
|
||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
<PackagePath>\</PackagePath>
|
<PackagePath>\</PackagePath>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.4.1" />
|
||||||
|
<PackageReference Include="DigitalData.Core.Application" Version="3.2.1" />
|
||||||
|
<PackageReference Include="DigitalData.Core.DTO" Version="2.0.1" />
|
||||||
|
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="3.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||||
<PackageReference Include="DigitalData.Core.Application" Version="2.0.0" />
|
|
||||||
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
|
||||||
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
|
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
|
||||||
@@ -34,16 +41,26 @@
|
|||||||
<PackageReference Include="System.DirectoryServices.Protocols" Version="7.0.1" />
|
<PackageReference Include="System.DirectoryServices.Protocols" Version="7.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||||
<ProjectReference Include="..\DigitalData.UserManager.Domain\DigitalData.UserManager.Domain.csproj" />
|
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||||
<ProjectReference Include="..\DigitalData.UserManager.Infrastructure\DigitalData.UserManager.Infrastructure.csproj" />
|
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
|
||||||
|
<PackageReference Include="System.DirectoryServices" Version="8.0.0" />
|
||||||
|
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="8.0.1" />
|
||||||
|
<PackageReference Include="System.DirectoryServices.Protocols" Version="8.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
|
||||||
|
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.4" />
|
||||||
|
<PackageReference Include="System.DirectoryServices" Version="9.0.4" />
|
||||||
|
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="9.0.4" />
|
||||||
|
<PackageReference Include="System.DirectoryServices.Protocols" Version="9.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Assets\icon.png">
|
<ProjectReference Include="..\DigitalData.UserManager.Domain\DigitalData.UserManager.Domain.csproj" />
|
||||||
<Pack>True</Pack>
|
|
||||||
<PackagePath>\</PackagePath>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -8,5 +8,7 @@
|
|||||||
public static readonly string UserAlreadyExists = "UserAlreadyExists";
|
public static readonly string UserAlreadyExists = "UserAlreadyExists";
|
||||||
public static readonly string UserNotFound = "UserNotFound";
|
public static readonly string UserNotFound = "UserNotFound";
|
||||||
public static readonly string UnauthorizedUser = "UnauthorizedUser";
|
public static readonly string UnauthorizedUser = "UnauthorizedUser";
|
||||||
|
public static readonly string DateRangeNotXNOR = "DateRangeNotXNOR";
|
||||||
|
public static readonly string InvalidDateRange = "InvalidDateRange";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,11 +9,10 @@ using DigitalData.UserManager.Domain.Entities;
|
|||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
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>
|
public class BaseService<TCRUDRepository, TCreateDto, TReadDto, TBaseEntity> : CRUDService<TCRUDRepository, TCreateDto, TReadDto, TBaseEntity, int>, IBaseService<TCreateDto, TReadDto, TBaseEntity>
|
||||||
where TCRUDRepository : ICRUDRepository<TBaseEntity, int>
|
where TCRUDRepository : ICRUDRepository<TBaseEntity, int>
|
||||||
where TCreateDto : BaseCreateDto
|
where TCreateDto : BaseCreateDto
|
||||||
where TReadDto : class
|
where TReadDto : class
|
||||||
where TUpdateDto : BaseUpdateDto
|
|
||||||
where TBaseEntity : BaseEntity
|
where TBaseEntity : BaseEntity
|
||||||
{
|
{
|
||||||
public BaseService(TCRUDRepository repository, IMapper mapper) : base(repository, mapper)
|
public BaseService(TCRUDRepository repository, IMapper mapper) : base(repository, mapper)
|
||||||
@@ -37,12 +36,13 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
return await base.CreateAsync(createDto);
|
return await base.CreateAsync(createDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<Result> UpdateAsync(TUpdateDto updateDto)
|
// made without generic type
|
||||||
|
public override async Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto)
|
||||||
{
|
{
|
||||||
var user = await GetUserAsync();
|
var user = await GetUserAsync();
|
||||||
if (user is not null)
|
if (user is not null && updateDto is BaseUpdateDto baseUpdateDto)
|
||||||
{
|
{
|
||||||
updateDto.ChangedWho = user.Username;
|
baseUpdateDto.ChangedWho = user.Username;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await base.UpdateAsync(updateDto);
|
return await base.UpdateAsync(updateDto);
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ using DigitalData.Core.DTO;
|
|||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class GroupOfUserService : BaseService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser>, IGroupOfUserService
|
public class GroupOfUserService : BaseService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUser>, IGroupOfUserService
|
||||||
{
|
{
|
||||||
public GroupOfUserService(IGroupOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
public GroupOfUserService(IGroupOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ 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;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class GroupService : BaseService<IGroupRepository, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group>, IGroupService
|
public class GroupService : BaseService<IGroupRepository, GroupCreateDto, GroupReadDto, 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, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
_localizer = localizer;
|
_localizer = localizer;
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
group.AddedWho = user?.AddedWho ?? "UNAUTHORIZED";
|
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].Value);
|
||||||
|
|
||||||
var createdGroup = await _repository.CreateAsync(group);
|
var createdGroup = await _repository.CreateAsync(group);
|
||||||
if (createdGroup is null)
|
if (createdGroup is null)
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ using DigitalData.Core.DTO;
|
|||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class ModuleOfUserService : CRUDService<IModuleOfUserRepository, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>, IModuleOfUserService
|
public class ModuleOfUserService : CRUDService<IModuleOfUserRepository, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUser, int>, IModuleOfUserService
|
||||||
{
|
{
|
||||||
public ModuleOfUserService(IModuleOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
public ModuleOfUserService(IModuleOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using DigitalData.Core.Application;
|
|||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.Module;
|
using DigitalData.UserManager.Application.DTOs.Module;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,15 +3,18 @@ using DigitalData.Core.DTO;
|
|||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class UserRepService : BaseService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep>, IUserRepService
|
public class UserRepService : BaseService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRep>, IUserRepService
|
||||||
{
|
{
|
||||||
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
|
private readonly IStringLocalizer<Resource>? _localizer;
|
||||||
|
public UserRepService(IUserRepRepository repository, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
|
_localizer = localizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null)
|
public async Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null)
|
||||||
@@ -20,5 +23,14 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
var urReadDTOs = _mapper.Map<IEnumerable<UserRepReadDto>>(urs);
|
var urReadDTOs = _mapper.Map<IEnumerable<UserRepReadDto>>(urs);
|
||||||
return Result.Success(urReadDTOs);
|
return Result.Success(urReadDTOs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override async Task<DataResult<int>> CreateAsync(UserRepCreateDto createDto)
|
||||||
|
// XOR control
|
||||||
|
=> (createDto.ValidFrom is null && createDto.ValidTo is not null) || (createDto.ValidFrom is not null && createDto.ValidTo is null)
|
||||||
|
? Result.Fail<int>().Notice(LogLevel.None, Flag.DataIntegrityIssue, _localizer?[Key.DateRangeNotXNOR].Value)
|
||||||
|
//date range control
|
||||||
|
: (createDto.ValidFrom > createDto.ValidTo)
|
||||||
|
? Result.Fail<int>().Notice(LogLevel.None, Flag.DataIntegrityIssue, _localizer?[Key.InvalidDateRange].Value)
|
||||||
|
: await base.CreateAsync(createDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,15 +3,15 @@ using DigitalData.Core.DTO;
|
|||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Application.Services
|
namespace DigitalData.UserManager.Application.Services
|
||||||
{
|
{
|
||||||
public class UserService : BaseService<IUserRepository, UserCreateDto, UserReadDto, UserUpdateDto, User>, IUserService
|
public class UserService : BaseService<IUserRepository, UserCreateDto, UserReadDto, 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, IMapper mapper, IStringLocalizer<Resource>? localizer = null) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
_localizer = localizer;
|
_localizer = localizer;
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
var user = _mapper.Map<User>(upDto);
|
var user = _mapper.Map<User>(upDto);
|
||||||
|
|
||||||
if (await HasEntity(user.Id))
|
if (await HasEntity(user.Id))
|
||||||
return Result.Fail<int>().Message(_localizer[Key.UserAlreadyExists]);
|
return Result.Fail<int>().Message(_localizer?[Key.UserAlreadyExists].Value);
|
||||||
|
|
||||||
//set the user
|
//set the user
|
||||||
var current_user = await GetUserAsync();
|
var current_user = await GetUserAsync();
|
||||||
@@ -66,7 +66,7 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
{
|
{
|
||||||
var user = await _repository.ReadByUsernameAsync(username);
|
var user = await _repository.ReadByUsernameAsync(username);
|
||||||
if (user is null)
|
if (user is null)
|
||||||
return Result.Fail<UserReadDto>().Message(_localizer[Key.UserNotFoundInLocalDB]);
|
return Result.Fail<UserReadDto>().Message(_localizer?[Key.UserNotFoundInLocalDB].Value);
|
||||||
|
|
||||||
var userDto = _mapper.Map<UserReadDto>(user);
|
var userDto = _mapper.Map<UserReadDto>(user);
|
||||||
return Result.Success(userDto);
|
return Result.Success(userDto);
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<PackageId>UserManager</PackageId>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Authors>Digital Data GmbH</Authors>
|
||||||
|
<Company>Digital Data GmbH</Company>
|
||||||
|
<Product>UserManager</Product>
|
||||||
|
<Description>Die Hauptbibliothek, die Benutzer-, Gruppen- und Modulzuweisungen über Active Directory mit Entity Framework durchführt.</Description>
|
||||||
|
<Copyright>Copyright 2024</Copyright>
|
||||||
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
|
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||||
|
<PackageTags>digital data user maanger</PackageTags>
|
||||||
|
<AssemblyVersion>1.0.0</AssemblyVersion>
|
||||||
|
<FileVersion>1.0.0</FileVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\Assets\icon.png">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath>\</PackagePath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\DigitalData.UserManager.Application\DigitalData.UserManager.Application.csproj" />
|
||||||
|
<ProjectReference Include="..\DigitalData.UserManager.Domain\DigitalData.UserManager.Domain.csproj" />
|
||||||
|
<ProjectReference Include="..\DigitalData.UserManager.Infrastructure\DigitalData.UserManager.Infrastructure.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
25
DigitalData.UserManager.DependencyInjection/Extensions.cs
Normal file
25
DigitalData.UserManager.DependencyInjection/Extensions.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using DigitalData.UserManager.Application;
|
||||||
|
using DigitalData.UserManager.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.DependencyInjection;
|
||||||
|
|
||||||
|
public static class Extensions
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddUserManager<TDbContext>(this IServiceCollection services)
|
||||||
|
where TDbContext : DbContext, IUserManagerDbContext
|
||||||
|
{
|
||||||
|
services.AddUserManagerInfrastructure<TDbContext>();
|
||||||
|
services.AddUserManagerApplication();
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IServiceCollection AddUserManager(this IServiceCollection services, Action<DbContextOptionsBuilder> optionsAction)
|
||||||
|
{
|
||||||
|
services.AddUserManagerInfrastructure(optionsAction);
|
||||||
|
services.AddUserManagerApplication();
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.1 KiB |
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>UserManager.Domain</PackageId>
|
<PackageId>UserManager.Domain</PackageId>
|
||||||
<Version>2.0.0.0</Version>
|
<Version>3.0.2</Version>
|
||||||
<Authors>Digital Data GmbH</Authors>
|
<Authors>Digital Data GmbH</Authors>
|
||||||
<Company>Digital Data GmbH</Company>
|
<Company>Digital Data GmbH</Company>
|
||||||
<Product>UserManager.Domain</Product>
|
<Product>UserManager.Domain</Product>
|
||||||
@@ -14,24 +14,19 @@
|
|||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||||
<PackageTags>digital data domain user maanger</PackageTags>
|
<PackageTags>digital data domain user maanger</PackageTags>
|
||||||
|
<AssemblyVersion>3.0.2</AssemblyVersion>
|
||||||
|
<FileVersion>3.0.2</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\DigitalData.UserManager.Application\Assets\icon.png">
|
<None Include="..\Assets\icon.png">
|
||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
<PackagePath>\</PackagePath>
|
<PackagePath>\</PackagePath>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DigitalData.Core.Abstractions" Version="2.0.0" />
|
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.4.0" />
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="Assets\icon.png">
|
|
||||||
<Pack>True</Pack>
|
|
||||||
<PackagePath>\</PackagePath>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -18,13 +18,11 @@ namespace DigitalData.UserManager.Domain.Entities
|
|||||||
[Column("REPR_USER")]
|
[Column("REPR_USER")]
|
||||||
public int? RepUserId { get; set; }
|
public int? RepUserId { get; set; }
|
||||||
|
|
||||||
[Required]
|
|
||||||
[Column("VALID_FROM")]
|
[Column("VALID_FROM")]
|
||||||
public required DateTime? ValidFrom { get; set; }
|
public DateTime? ValidFrom { get; set; }
|
||||||
|
|
||||||
[Required]
|
|
||||||
[Column("VALID_TO")]
|
[Column("VALID_TO")]
|
||||||
public required DateTime? ValidTo { get; set; }
|
public DateTime? ValidTo { get; set; }
|
||||||
|
|
||||||
[ForeignKey("UserId")]
|
[ForeignKey("UserId")]
|
||||||
public virtual User? User { get; set; }
|
public virtual User? User { get; set; }
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.1 KiB |
@@ -1,10 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
|
||||||
{
|
|
||||||
public interface IClientUserRepository : ICRUDRepository<ClientUser, int>
|
|
||||||
{
|
|
||||||
Task<IEnumerable<ClientUser>> ReadAsync(bool readOnly = true, int? userId = null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
|
||||||
{
|
|
||||||
public interface IGroupOfUserRepository : ICRUDRepository<GroupOfUser, int>
|
|
||||||
{
|
|
||||||
IQueryable<GroupOfUser> ReadByGroupId(int groupId);
|
|
||||||
|
|
||||||
Task<IEnumerable<GroupOfUser>> ReadByGroupUserIdAsync(int groupId, int userId);
|
|
||||||
|
|
||||||
Task<IEnumerable<GroupOfUser>> ReadAllAsyncWithGroup();
|
|
||||||
|
|
||||||
Task<IEnumerable<GroupOfUser>> ReadAllAsyncWithUser();
|
|
||||||
|
|
||||||
Task<IEnumerable<GroupOfUser>> ReadAllAsyncWithGroupAndUser();
|
|
||||||
|
|
||||||
Task<IEnumerable<GroupOfUser>> ReadByUsernameAsync(string username);
|
|
||||||
|
|
||||||
Task<IEnumerable<GroupOfUser>> ReadByUserIdAsync(int userId);
|
|
||||||
|
|
||||||
// merge all GroupOfUserRepository-methods conditionally under this method
|
|
||||||
Task<IEnumerable<GroupOfUser>> ReadAsync(
|
|
||||||
bool readOnly = true,
|
|
||||||
bool withGroup = true, bool withUser = true,
|
|
||||||
int? id = null, int? groupId = null, int? userId = null, string? username = null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
|
||||||
{
|
|
||||||
public interface IGroupRepository : ICRUDRepository<Group, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
|
||||||
{
|
|
||||||
public interface IModuleOfUserRepository : ICRUDRepository<ModuleOfUser, int>
|
|
||||||
{
|
|
||||||
IQueryable<ModuleOfUser> ReadByModuleId(int moduleId);
|
|
||||||
|
|
||||||
Task<IEnumerable<ModuleOfUser>> ReadByModelUserIdAsync(int moduleId, int userId);
|
|
||||||
|
|
||||||
Task<IEnumerable<ModuleOfUser>> ReadByUserAsync(string username);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
|
||||||
{
|
|
||||||
public interface IModuleRepository : ICRUDRepository<Module, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
namespace DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
|
|
||||||
|
public interface IUserManagerDbContext
|
||||||
{
|
{
|
||||||
public interface IUserManagerDbContext
|
|
||||||
{
|
|
||||||
public DbSet<GroupOfUser> GroupOfUsers { get; }
|
public DbSet<GroupOfUser> GroupOfUsers { get; }
|
||||||
|
|
||||||
public DbSet<Group> Groups { get; }
|
public DbSet<Group> Groups { get; }
|
||||||
@@ -18,5 +18,4 @@ namespace DigitalData.UserManager.Infrastructure.Contracts
|
|||||||
public DbSet<UserRep> UserReps { get; }
|
public DbSet<UserRep> UserReps { get; }
|
||||||
|
|
||||||
public DbSet<ClientUser> ClientUsers { get; }
|
public DbSet<ClientUser> ClientUsers { get; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
|
||||||
{
|
|
||||||
public interface IUserRepRepository : ICRUDRepository<UserRep, int>
|
|
||||||
{
|
|
||||||
Task<IEnumerable<UserRep>> ReadAllAsync(
|
|
||||||
bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false,
|
|
||||||
int? userId = null, int? repUserId = null, int? groupId = null, int? repGroupId = null, bool readOnly = true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Contracts
|
|
||||||
{
|
|
||||||
public interface IUserRepository : ICRUDRepository<User, int>
|
|
||||||
{
|
|
||||||
Task<IEnumerable<User>> ReadByModuleIdAsync(int moduleId);
|
|
||||||
|
|
||||||
Task<IEnumerable<User>> ReadUnassignedByModuleIdAsync(int moduleId);
|
|
||||||
|
|
||||||
Task<IEnumerable<User>> ReadByGroupIdAsync(int groupId);
|
|
||||||
|
|
||||||
Task<IEnumerable<User>> ReadUnassignedByGroupIdAsync(int groupId);
|
|
||||||
|
|
||||||
Task<User?> ReadByUsernameAsync(string username);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using DigitalData.UserManager.Application;
|
||||||
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
|
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace DigitalData.UserManager.Infrastructure;
|
||||||
|
|
||||||
|
public static class DependencyInjection
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the UserManager repositories to the specified <see cref="IServiceCollection"/>.
|
||||||
|
/// This method registers the necessary repositories for the UserManager.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDbContext">The type of the DbContext to use for the repositories.</typeparam>
|
||||||
|
/// <param name="services">The IServiceCollection to which the services will be added.</param>
|
||||||
|
/// <returns>The updated IServiceCollection.</returns>
|
||||||
|
public static IServiceCollection AddUserManagerInfrastructure<TDbContext>(this IServiceCollection services)
|
||||||
|
where TDbContext : DbContext, IUserManagerDbContext
|
||||||
|
{
|
||||||
|
return services
|
||||||
|
.AddScoped<IUserRepository, UserRepository<TDbContext>>()
|
||||||
|
.AddScoped<IGroupRepository, GroupRepository<TDbContext>>()
|
||||||
|
.AddScoped<IGroupOfUserRepository, GroupOfUserRepository<TDbContext>>()
|
||||||
|
.AddScoped<IModuleRepository, ModuleRepository<TDbContext>>()
|
||||||
|
.AddScoped<IModuleOfUserRepository, ModuleOfUserRepository<TDbContext>>()
|
||||||
|
.AddScoped<IUserRepRepository, UserRepRepository<TDbContext>>()
|
||||||
|
.AddScoped<IClientUserRepository, ClientUserRepository<TDbContext>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the UserManager services and repositories to the specified <see cref="IServiceCollection"/>.
|
||||||
|
/// This method allows configuring the DbContext options using the provided <paramref name="optionsAction"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">The <see cref="IServiceCollection"/> to which the services will be added.</param>
|
||||||
|
/// <param name="optionsAction">An <see cref="Action{T}"/> to configure the <see cref="DbContextOptionsBuilder"/>.</param>
|
||||||
|
/// <returns>The updated <see cref="IServiceCollection"/>.</returns>
|
||||||
|
public static IServiceCollection AddUserManagerInfrastructure(this IServiceCollection services, Action<DbContextOptionsBuilder> optionsAction) => services
|
||||||
|
.AddDbContext<UserManagerDbContext>(optionsAction)
|
||||||
|
.AddUserManagerInfrastructure<UserManagerDbContext>();
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<PackageId>UserManager.Infrastructure</PackageId>
|
<PackageId>UserManager.Infrastructure</PackageId>
|
||||||
<Version>2.0.0.0</Version>
|
<Version>3.0.2</Version>
|
||||||
<Authors>Digital Data GmbH</Authors>
|
<Authors>Digital Data GmbH</Authors>
|
||||||
<Company>Digital Data GmbH</Company>
|
<Company>Digital Data GmbH</Company>
|
||||||
<Product>UserManager.Infrastructure</Product>
|
<Product>UserManager.Infrastructure</Product>
|
||||||
@@ -14,34 +14,39 @@
|
|||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||||
<PackageTags>digital data infrastructure user maanger</PackageTags>
|
<PackageTags>digital data infrastructure user maanger</PackageTags>
|
||||||
|
<AssemblyVersion>3.0.2</AssemblyVersion>
|
||||||
|
<FileVersion>3.0.2</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\DigitalData.UserManager.Domain\Assets\icon.png">
|
<None Include="..\Assets\icon.png">
|
||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
<PackagePath>\</PackagePath>
|
<PackagePath>\</PackagePath>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.0.0" />
|
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.16" />
|
</ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
|
||||||
</PackageReference>
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.20" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.15" />
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.15" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.15" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\DigitalData.UserManager.Application\DigitalData.UserManager.Application.csproj" />
|
||||||
<ProjectReference Include="..\DigitalData.UserManager.Domain\DigitalData.UserManager.Domain.csproj" />
|
<ProjectReference Include="..\DigitalData.UserManager.Domain\DigitalData.UserManager.Domain.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="Assets\icon.png">
|
|
||||||
<Pack>True</Pack>
|
|
||||||
<PackagePath>\</PackagePath>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
||||||
{
|
|
||||||
public class ModuleOfUserRepository<TDbContext> : CRUDRepository<ModuleOfUser, int, TDbContext>, IModuleOfUserRepository
|
public class ModuleOfUserRepository<TDbContext> : CRUDRepository<ModuleOfUser, int, TDbContext>, IModuleOfUserRepository
|
||||||
where TDbContext : DbContext, IUserManagerDbContext
|
where TDbContext : DbContext, IUserManagerDbContext
|
||||||
{
|
{
|
||||||
public ModuleOfUserRepository(TDbContext dbContext) : base(dbContext, dbContext.ModuleOfUsers)
|
public ModuleOfUserRepository(TDbContext dbContext) : base(dbContext, dbContext.ModuleOfUsers)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -28,5 +29,4 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ModuleOfUser>> ReadByUserAsync(string username) => await ReadByUser(username).ToListAsync();
|
public async Task<IEnumerable<ModuleOfUser>> ReadByUserAsync(string username) => await ReadByUser(username).ToListAsync();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
||||||
{
|
|
||||||
public class ModuleRepository<TDbContext> : CRUDRepository<Module, int, TDbContext>, IModuleRepository
|
public class ModuleRepository<TDbContext> : CRUDRepository<Module, int, TDbContext>, IModuleRepository
|
||||||
where TDbContext : DbContext, IUserManagerDbContext
|
where TDbContext : DbContext, IUserManagerDbContext
|
||||||
{
|
{
|
||||||
public ModuleRepository(TDbContext dbContext) : base(dbContext, dbContext.Modules)
|
public ModuleRepository(TDbContext dbContext) : base(dbContext, dbContext.Modules)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
||||||
{
|
|
||||||
public class UserRepRepository<TDbContext> : CRUDRepository<UserRep, int, TDbContext>, IUserRepRepository
|
public class UserRepRepository<TDbContext> : CRUDRepository<UserRep, int, TDbContext>, IUserRepRepository
|
||||||
where TDbContext : DbContext, IUserManagerDbContext
|
where TDbContext : DbContext, IUserManagerDbContext
|
||||||
{
|
{
|
||||||
public UserRepRepository(TDbContext dbContext) : base(dbContext, dbContext.UserReps)
|
public UserRepRepository(TDbContext dbContext) : base(dbContext, dbContext.UserReps)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -44,5 +45,4 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
|||||||
|
|
||||||
return await query.ToListAsync();
|
return await query.ToListAsync();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.Infrastructure;
|
using DigitalData.Core.Infrastructure;
|
||||||
|
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|||||||
@@ -11,32 +11,48 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.UserManager.Inf
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.UserManager.API", "DigitalData.UserManager.API\DigitalData.UserManager.API.csproj", "{07CCD651-647C-49F7-9715-30CEBC13710D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.UserManager.API", "DigitalData.UserManager.API\DigitalData.UserManager.API.csproj", "{07CCD651-647C-49F7-9715-30CEBC13710D}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.UserManager.DependencyInjection", "DigitalData.UserManager.DependencyInjection\DigitalData.UserManager.DependencyInjection.csproj", "{7E5FD115-EE6D-48F2-ACF1-E951EC071073}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
Assets\icon.png = Assets\icon.png
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{BC8CEADC-F7D6-4469-8718-4B308C386B4D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0634853C-C515-48AF-8E27-E5CBF592BCE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1DD81373-82F9-4872-95C6-888624DB1797}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1DD81373-82F9-4872-95C6-888624DB1797}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{07CCD651-647C-49F7-9715-30CEBC13710D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{07CCD651-647C-49F7-9715-30CEBC13710D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{07CCD651-647C-49F7-9715-30CEBC13710D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{07CCD651-647C-49F7-9715-30CEBC13710D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{07CCD651-647C-49F7-9715-30CEBC13710D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{07CCD651-647C-49F7-9715-30CEBC13710D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{07CCD651-647C-49F7-9715-30CEBC13710D}.Release|Any CPU.Build.0 = Release|Any CPU
|
{07CCD651-647C-49F7-9715-30CEBC13710D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7E5FD115-EE6D-48F2-ACF1-E951EC071073}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7E5FD115-EE6D-48F2-ACF1-E951EC071073}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7E5FD115-EE6D-48F2-ACF1-E951EC071073}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7E5FD115-EE6D-48F2-ACF1-E951EC071073}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}
|
||||||
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {6804DE1E-B257-4DC9-B9D4-08C8518C8282}
|
SolutionGuid = {6804DE1E-B257-4DC9-B9D4-08C8518C8282}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|||||||
Reference in New Issue
Block a user