Compare commits
26 Commits
feat/authF
...
0057a2d260
| Author | SHA1 | Date | |
|---|---|---|---|
| 0057a2d260 | |||
| 854db39f30 | |||
| f79fa4ca27 | |||
| 55822047bc | |||
| de360968dc | |||
| 06303ec2b5 | |||
| 437f33a323 | |||
| 963ab12488 | |||
| df24905a0e | |||
| 0659734346 | |||
| 9af19713a0 | |||
| 06ad3516f1 | |||
| 23c7b7a293 | |||
| 53bfc4a413 | |||
| 3de7e64f85 | |||
| 39a9181257 | |||
| 5d3f73bb13 | |||
| bc44de63ee | |||
| b1075c8b82 | |||
| 40deb9968f | |||
| 182771afd2 | |||
| 668eef2a4d | |||
| e9527ca61e | |||
| 8f2ec82d4f | |||
| cc708cae0c | |||
| b936677c16 |
@@ -3,7 +3,8 @@
|
||||
"version": "4.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve --ssl -o",
|
||||
"start:ssl": "ng serve --ssl -o",
|
||||
"start": "ng serve -o",
|
||||
"build": "ng build --configuration production",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"/api": {
|
||||
"target": "https://localhost:7103",
|
||||
"target": "https://localhost:7052",
|
||||
"secure": false,
|
||||
"changeOrigin": true
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { Group } from '../../../models/user-management.api.models';
|
||||
import { Group } from '../../../services/api/api-models';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, inject, ChangeDetectionStrategy, signal, OnInit, computed } from '@angular/core';
|
||||
import { UserRep } from '../../../models/user-management.api.models';
|
||||
import { UserRep } from '../../../services/api/api-models';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { UserRepService } from '../../../services/api/user-representation.service';
|
||||
import { GroupUpdateFormComponent } from '../group-update-form/group-update-form.component';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { User } from '../../../models/user-management.api.models';
|
||||
import { User } from '../../../services/api/api-models';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
@@ -5,7 +5,7 @@ import { GroupService } from '../../services/api/group.service';
|
||||
import { Observable, forkJoin, of } from 'rxjs';
|
||||
import { catchError, finalize } from 'rxjs/operators';
|
||||
import { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';
|
||||
import { DirGroup } from '../../models/user-management.api.models';
|
||||
import { DirGroup } from '../../services/api/api-models';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
|
||||
@@ -36,7 +36,7 @@ export class NavMenuComponent {
|
||||
isChecked = true;
|
||||
|
||||
constructor(private dialog: MatDialog, private authService: AuthenticationService, public refreshService: RefreshService, public creationService: CreationService, public updateService: UpdateService, public transferService: TransferService, public buttonVisibilityService: ButtonVisibilityService, public deletionService: DeletionService) {
|
||||
this.authService.isAuthenticated().then().catch()
|
||||
this.authService.isAuthenticated()
|
||||
this.updateActCount = this.updateService.totalCount;
|
||||
this.updateService.addChangeListener(UpdateEvent.CountChange, () => {
|
||||
this.updateActCount = updateService.totalCount;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { User } from '../../../models/user-management.api.models'
|
||||
import { User } from '../../../services/api/api-models'
|
||||
import { MAT_BOTTOM_SHEET_DATA } from '@angular/material/bottom-sheet';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { BaseTableComponent } from './base-table.component';
|
||||
import { ApiService } from '../../../services/api/user-management.api.service';
|
||||
import { ApiService } from '../../../services/api/api-service';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
|
||||
describe('BaseTableComponent', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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/api-service';
|
||||
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 { ColorModeService, Theme } from '../../../services/button/color-mode.service';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||
import { DirGroupService } from '../../../services/api/dir-group.service';
|
||||
import { DirGroup } from '../../../models/user-management.api.models';
|
||||
import { DirGroup } from '../../../services/api/api-models';
|
||||
import { GuiGridModule } from '@generic-ui/ngx-grid';
|
||||
import { ColorModeService } from '../../../services/button/color-mode.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { DirUser } from '../../../models/user-management.api.models';
|
||||
import { DirUser } from '../../../services/api/api-models';
|
||||
import { DirUserService } from '../../../services/api/dir-user.service';
|
||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||
import { GuiGridModule, GuiColumn } from '@generic-ui/ngx-grid';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { GroupService } from '../../../services/api/group.service';
|
||||
import { Group } from '../../../models/user-management.api.models';
|
||||
import { Group } from '../../../services/api/api-models';
|
||||
import { GuiGridModule, GuiColumn } from '@generic-ui/ngx-grid';
|
||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||
import { ColorModeService } from '../../../services/button/color-mode.service';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { GroupOfUserService } from '../../../services/group-of-user.service';
|
||||
import { GroupOfUser } from '../../../models/user-management.api.models';
|
||||
import { GroupOfUser } from '../../../services/api/api-models';
|
||||
import { GuiGridModule, GuiColumn } from '@generic-ui/ngx-grid';
|
||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||
import { ColorModeService } from '../../../services/color-mode.service';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Module } from '../../../models/user-management.api.models';
|
||||
import { Module } from '../../../services/api/api-models';
|
||||
import { GuiGridModule } from '@generic-ui/ngx-grid';
|
||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||
import { ModuleService } from '../../../services/api/module.service'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { UserRep } from '../../../models/user-management.api.models';
|
||||
import { UserRep } from '../../../services/api/api-models';
|
||||
import { UserRepService } from '../../../services/api/user-representation.service';
|
||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||
import { GuiGridModule } from '@generic-ui/ngx-grid';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
|
||||
import { UserService } from '../../../services/api/user.service';
|
||||
import { ModuleOfUserService } from '../../../services/api/module-of-user.service';
|
||||
import { GroupOfUserService } from '../../../services/api/group-of-user.service';
|
||||
import { User } from '../../../models/user-management.api.models';
|
||||
import { User } from '../../../services/api/api-models';
|
||||
import { GuiGridModule } from '@generic-ui/ngx-grid';
|
||||
import { BaseTableComponent } from '../base-table/base-table.component';
|
||||
import { ColorModeService } from '../../../services/button/color-mode.service'
|
||||
|
||||
@@ -7,7 +7,7 @@ import { catchError, finalize } from 'rxjs/operators';
|
||||
import { DirGroupTableComponent } from '../tables/dir-group-table/dir-group-table.component';
|
||||
import { DirUserTableComponent } from '../tables/dir-user-table/dir-user-table.component';
|
||||
import { UserService } from '../../services/api/user.service';
|
||||
import { User } from '../../models/user-management.api.models'
|
||||
import { User } from '../../services/api/api-models'
|
||||
import { RefreshService } from '../../services/button/refresh.service';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { GuiCellEdit, GuiSelectedRow } from '@generic-ui/ngx-grid';
|
||||
import { GroupFormComponent } from '../../components/forms/group-form/group-form.component';
|
||||
import { BasePageComponent } from '../base-page/base-page.component';
|
||||
import { Group } from '../../models/user-management.api.models';
|
||||
import { Group } from '../../services/api/api-models';
|
||||
import { firstValueFrom, forkJoin } from 'rxjs';
|
||||
import Swal from 'sweetalert2';
|
||||
import { env } from '../../../environments/environment';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { GuiRowSelection, GuiRowSelectionMode, GuiRowSelectionType, GuiSelectedR
|
||||
import { UserTableComponent } from '../../components/tables/user-table/user-table.component';
|
||||
import { ModuleTableComponent } from '../../components/tables/module-table/module-table.component';
|
||||
import { GroupTableComponent } from '../../components/tables/group-table/group-table.component';
|
||||
import { User } from '../../models/user-management.api.models';
|
||||
import { User } from '../../services/api/api-models';
|
||||
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
||||
import { BasePageComponent } from '../base-page/base-page.component';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import Swal from 'sweetalert2';
|
||||
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
||||
import { env } from '../../../environments/environment';
|
||||
import { BasePageComponent } from '../base-page/base-page.component';
|
||||
import { Group, User, UserRep } from '../../models/user-management.api.models';
|
||||
import { Group, User, UserRep } from '../../services/api/api-models';
|
||||
import { RepCreateFormComponent } from '../../components/forms/rep-create-form/rep-create-form.component';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { BaseTableComponent } from '../../components/tables/base-table/base-table.component';
|
||||
|
||||
@@ -6,7 +6,7 @@ import { GroupTableComponent } from '../../components/tables/group-table/group-t
|
||||
import { ModuleTableComponent } from '../../components/tables/module-table/module-table.component';
|
||||
import { UserCreateFormComponent } from '../../components/forms/user-create-form/user-create-form.component';
|
||||
import { BasePageComponent } from '../base-page/base-page.component';
|
||||
import { User } from '../../models/user-management.api.models';
|
||||
import { User } from '../../services/api/api-models';
|
||||
import { firstValueFrom, forkJoin } from 'rxjs';
|
||||
import Swal from 'sweetalert2';
|
||||
import { env } from '../../../environments/environment'
|
||||
|
||||
@@ -8,6 +8,8 @@ export interface User {
|
||||
language?: string;
|
||||
comment?: string;
|
||||
deleted?: boolean;
|
||||
deletedWhen?: Date;
|
||||
deletedWho?: string;
|
||||
dateFormat?: string;
|
||||
addedWho?: string;
|
||||
addedWhen?: Date;
|
||||
@@ -70,7 +72,7 @@ export interface UserRep {
|
||||
repUser?: User
|
||||
user?: User,
|
||||
repGroup?: Group,
|
||||
group?: Group,
|
||||
group?: Group,
|
||||
}
|
||||
|
||||
export interface DirGroup {
|
||||
@@ -17,21 +17,22 @@ export class AuthenticationService {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private http: HttpClient,
|
||||
urlService : UrlService)
|
||||
{
|
||||
this.loginUrl = urlService.apiRoute.login;
|
||||
this.logoutUrl = urlService.apiRoute.logout;
|
||||
this.checkUrl = urlService.apiRoute.loginCheck;
|
||||
}
|
||||
urlService: UrlService) {
|
||||
this.loginUrl = urlService.apiRoute.login;
|
||||
this.logoutUrl = urlService.apiRoute.logout;
|
||||
this.checkUrl = urlService.apiRoute.loginCheck;
|
||||
}
|
||||
|
||||
async isAuthenticated(): Promise<boolean> {
|
||||
try {
|
||||
const response = await firstValueFrom(this.http.get<boolean>(this.checkUrl, { withCredentials: true }));
|
||||
_isLogedIn = response;
|
||||
return response;
|
||||
} catch (error) {
|
||||
this.showErrorAlert();
|
||||
return false;
|
||||
const response = await firstValueFrom(this.http.get(this.checkUrl, { withCredentials: true, observe: 'response' }));
|
||||
_isLogedIn = response?.status === 200;
|
||||
return _isLogedIn;
|
||||
} catch (error: any) {
|
||||
if (error?.status !== 401)
|
||||
this.showErrorAlert();
|
||||
_isLogedIn = false
|
||||
return _isLogedIn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,4 +82,4 @@ export class AuthenticationService {
|
||||
}
|
||||
|
||||
let _isLogedIn: boolean = false;
|
||||
export const IsLogedIn = () => _isLogedIn
|
||||
export const IsLogedIn = () => _isLogedIn
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DirGroup, } from '../../models/user-management.api.models';
|
||||
import { ApiService } from './user-management.api.service';
|
||||
import { DirGroup, } from './api-models';
|
||||
import { ApiService } from './api-service';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import Swal from 'sweetalert2';
|
||||
import { UrlService } from './url.service';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { DirUser } from '../../models/user-management.api.models';
|
||||
import { ApiService } from './user-management.api.service';
|
||||
import { DirUser } from './api-models';
|
||||
import { ApiService } from './api-service';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { UrlService } from './url.service';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { DirUser } from '../../models/user-management.api.models';
|
||||
import { DirUser } from './api-models';
|
||||
import { UrlService } from './url.service';
|
||||
|
||||
@Injectable({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { GroupOfUser } from '../../models/user-management.api.models';
|
||||
import { ApiService } from './user-management.api.service';
|
||||
import { GroupOfUser } from './api-models';
|
||||
import { ApiService } from './api-service';
|
||||
import { Observable, firstValueFrom } from 'rxjs';
|
||||
import { UrlService } from './url.service';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DirGroup, Group, } from '../../models/user-management.api.models';
|
||||
import { ApiService } from './user-management.api.service';
|
||||
import { DirGroup, Group, } from './api-models';
|
||||
import { ApiService } from './api-service';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { UrlService } from './url.service';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ModuleOfUser } from '../../models/user-management.api.models';
|
||||
import { ApiService } from './user-management.api.service';
|
||||
import { ModuleOfUser } from './api-models';
|
||||
import { ApiService } from './api-service';
|
||||
import { Observable, firstValueFrom } from 'rxjs';
|
||||
import { UrlService } from './url.service';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ApiService } from './user-management.api.service';
|
||||
import { Module } from '../../models/user-management.api.models';
|
||||
import { ApiService } from './api-service';
|
||||
import { Module } from './api-models';
|
||||
import { UrlService } from './url.service';
|
||||
|
||||
@Injectable({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Inject, Injectable } from "@angular/core";
|
||||
import { UserRep } from "../../models/user-management.api.models";
|
||||
import { ApiService } from "./user-management.api.service";
|
||||
import { UserRep } from "./api-models";
|
||||
import { ApiService } from "./api-service";
|
||||
import { HttpClient, HttpParams } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
import { UrlService } from "./url.service";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DirUser, User } from '../../models/user-management.api.models';
|
||||
import { ApiService } from './user-management.api.service';
|
||||
import { DirUser, User } from './api-models';
|
||||
import { ApiService } from './api-service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { UrlService } from './url.service';
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using DigitalData.UserManager.Application.DTOs.Auth;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.Core.DTO;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using DigitalData.UserManager.Application;
|
||||
using System.Security.Claims;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
@@ -13,10 +13,13 @@ namespace DigitalData.UserManager.API.Controllers;
|
||||
[ApiController]
|
||||
public class AuthController : ControllerBase
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly ILogger<UserController> _logger;
|
||||
[Obsolete("Use MediatR")]
|
||||
private readonly IUserService _userService;
|
||||
private readonly IStringLocalizer<Resource> _localizer;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public AuthController(ILogger<UserController> logger, IUserService userService, IStringLocalizer<Resource> localizer)
|
||||
{
|
||||
_logger = logger;
|
||||
@@ -34,6 +37,7 @@ public class AuthController : ControllerBase
|
||||
|
||||
[Authorize]
|
||||
[HttpGet("user")]
|
||||
[Obsolete("Use MediatR")]
|
||||
public async Task<IActionResult> GetUserWithClaims()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DigitalData.Core.API;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.Core.API;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.Base;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
@@ -10,6 +10,7 @@ using System.Security.Claims;
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
public class BaseAuthController<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TBaseEntity> : CRUDControllerBaseWithErrorHandling<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TBaseEntity, int>
|
||||
where TCRUDService : IBaseService<TCreateDto, TReadDto, TBaseEntity>
|
||||
where TCreateDto : BaseCreateDto
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
@@ -7,14 +6,16 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Security.Claims;
|
||||
using DigitalData.UserManager.Application;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using DigitalData.Core.DTO;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using DigitalData.Core.Abstraction.Application;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "<Pending>")]
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
public class DirectoryController : ControllerBase
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
public class GroupController : BaseAuthController<IGroupService, GroupCreateDto, GroupReadDto, GroupUpdateDto, Group>
|
||||
{
|
||||
public GroupController(ILogger<GroupController> logger, IGroupService service, IUserService userService) : base(logger, service, userService)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
public class GroupOfUserController : BaseAuthController<IGroupOfUserService, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUserUpdateDto, GroupOfUser>
|
||||
{
|
||||
public GroupOfUserController(ILogger<GroupOfUserController> logger, IGroupOfUserService service, IUserService userService) : base(logger, service, userService)
|
||||
|
||||
@@ -7,8 +7,10 @@ using Microsoft.AspNetCore.Authorization;
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
public class ModuleController : ReadControllerBaseWithErrorHandling<IModuleService, ModuleDto, Module, int>
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public ModuleController(ILogger<ModuleController> logger, IModuleService service) : base(logger, service)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.Core.API;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
@@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
public class ModuleOfUserController : CRUDControllerBaseWithErrorHandling<IModuleOfUserService, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUserUpdateDto, ModuleOfUser, int>
|
||||
{
|
||||
public ModuleOfUserController(ILogger<ModuleOfUserController> logger, IModuleOfUserService service) : base(logger, service)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
@@ -8,6 +8,9 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class UserController : BaseAuthController<IUserService, UserCreateDto, UserReadDto, UserUpdateDto, User>
|
||||
{
|
||||
public UserController(ILogger<UserController> logger, IUserService service) : base(logger, service, service)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace DigitalData.UserManager.API.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Obsolete("Use MediatR")]
|
||||
public class UserRepController : BaseAuthController<IUserRepService, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep>
|
||||
{
|
||||
public UserRepController(ILogger<UserRepController> logger, IUserRepService service, IUserService userService) : base(logger, service, userService)
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>6.0.1</Version>
|
||||
<AssemblyVersion>6.0.1</AssemblyVersion>
|
||||
<FileVersion>6.0.1</FileVersion>
|
||||
<Version>6.1.2</Version>
|
||||
<AssemblyVersion>6.1.2</AssemblyVersion>
|
||||
<FileVersion>6.1.2</FileVersion>
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DigitalData.Auth.Client" Version="1.3.5" />
|
||||
<PackageReference Include="DigitalData.Core.API" Version="2.1.1" />
|
||||
<PackageReference Include="DigitalData.Auth.Client" Version="1.3.7" />
|
||||
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.0.0" />
|
||||
<PackageReference Include="DigitalData.Core.API" Version="2.2.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.20" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using DigitalData.UserManager.Application;
|
||||
using DigitalData.Core.Application;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using NLog.Web;
|
||||
using NLog;
|
||||
using DigitalData.Core.API;
|
||||
@@ -31,8 +29,11 @@ try {
|
||||
|
||||
builder.Services.AddEncryptor(builder.Configuration.GetSection("EncryptionParameters"));
|
||||
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Host.UseNLog();
|
||||
if (!builder.Environment.IsDevelopment())
|
||||
{
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Host.UseNLog();
|
||||
}
|
||||
|
||||
builder.Services.AddControllers(opt =>
|
||||
{
|
||||
@@ -50,27 +51,12 @@ try {
|
||||
builder.Services.AddSwaggerGen();
|
||||
}
|
||||
|
||||
builder.Services.AddControllers(opt =>
|
||||
{
|
||||
opt.Conventions.Add(new RemoveIfControllerConvention()
|
||||
.AndIf(c => c.ControllerName == nameof(EncryptionController).Replace("Controller", ""))
|
||||
.AndIf(c => !config.GetValue<bool>("UseEncryptor")));
|
||||
});
|
||||
|
||||
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||
.AddCookie(options =>
|
||||
{
|
||||
options.Cookie.HttpOnly = true; // Makes the cookie inaccessible to client-side scripts for security
|
||||
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest; // Ensures cookies are sent over HTTPS only
|
||||
options.Cookie.SameSite = SameSiteMode.Strict; // Protects against CSRF attacks by restricting how cookies are sent with requests from external sites
|
||||
options.LoginPath = "/api/auth/login";
|
||||
options.LogoutPath = "/api/auth/logout";
|
||||
});
|
||||
|
||||
// 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;
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services.AddUserManager(options => options.UseSqlServer(cnn_str!.Value).EnableSensitiveDataLogging());
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
var allowedOrigins = builder.Configuration.GetSection("AllowedOrigins").Get<string[]>() ?? throw new InvalidOperationException("In appsettings there is no allowed origin.");
|
||||
|
||||
@@ -99,45 +85,44 @@ try {
|
||||
|
||||
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
|
||||
builder.Services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
})
|
||||
.AddJwtBearer(opt =>
|
||||
{
|
||||
ValidateIssuerSigningKey = true,
|
||||
IssuerSigningKeyResolver = (token, securityToken, identifier, parameters) =>
|
||||
opt.TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
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
|
||||
ValidateIssuerSigningKey = true,
|
||||
IssuerSigningKeyResolver = (token, securityToken, identifier, parameters) =>
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
builder.Services.AddSwaggerGen(setupAct =>
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<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\API\$(Version)\$(Version).zip</DesktopBuildPackageLocation>
|
||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||
<DeployIisAppPath>UserManager.API</DeployIisAppPath>
|
||||
<_TargetId>IISWebDeployPackage</_TargetId>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
"UseEncryptor": true,
|
||||
"UseSwagger": true,
|
||||
"AuthClientParams": {
|
||||
"Url": "https://localhost:7192/auth-hub",
|
||||
"Url": "https://localhost:9090/auth-hub",
|
||||
"PublicKeys": [
|
||||
{
|
||||
"Issuer": "auth.digitaldata.works",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Application.DTOs.Base;
|
||||
using DigitalData.Core.Abstraction.Application;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public interface IBaseService<TCreateDto, TReadDto, TBaseEntity> : ICRUDService<TCreateDto, TReadDto, TBaseEntity, int>
|
||||
where TCreateDto : BaseCreateDto
|
||||
where TReadDto : class
|
||||
@@ -14,5 +15,5 @@ namespace DigitalData.UserManager.Application.Contracts
|
||||
public Func<Task<UserReadDto?>> UserFactoryAsync { set; }
|
||||
|
||||
public Task<UserReadDto?> GetUserAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public interface IGroupOfUserService : IBaseService<GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUser>
|
||||
{
|
||||
Task<Result> DeleteAsyncByGroupUserId(int groupId, int userId);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public interface IGroupService : IBaseService<GroupCreateDto, GroupReadDto, Group>
|
||||
{
|
||||
Task<DataResult<int>> CreateAsync(DirectoryGroupDto dirGroup);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public interface IModuleOfUserService : ICRUDService<ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUser, int>
|
||||
{
|
||||
Task<Result> DeleteAsyncByModuleUserId(int moduleId, int userId);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Abstraction.Application;
|
||||
using DigitalData.UserManager.Application.DTOs.Module;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public interface IModuleService : IBasicCRUDService<ModuleDto, Module, int>
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
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);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public interface IUserService : IBaseService<UserCreateDto, UserReadDto, User>
|
||||
{
|
||||
Task<DataResult<IEnumerable<UserReadDto>>> ReadByModuleIdAsync(int moduleId);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IClientUserRepository : ICRUDRepository<ClientUser, int>
|
||||
{
|
||||
Task<IEnumerable<ClientUser>> ReadAsync(bool readOnly = true, int? userId = null);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IGroupOfUserRepository : ICRUDRepository<GroupOfUser, int>
|
||||
{
|
||||
IQueryable<GroupOfUser> ReadByGroupId(int groupId);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IGroupRepository : ICRUDRepository<Group, int>
|
||||
{
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IModuleOfUserRepository : ICRUDRepository<ModuleOfUser, int>
|
||||
{
|
||||
IQueryable<ModuleOfUser> ReadByModuleId(int moduleId);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IModuleRepository : ICRUDRepository<Module, int>
|
||||
{
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IUserRepRepository : ICRUDRepository<UserRep, int>
|
||||
{
|
||||
Task<IEnumerable<UserRep>> ReadAllAsync(
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public interface IUserRepository : ICRUDRepository<User, int>
|
||||
{
|
||||
Task<IEnumerable<User>> ReadByModuleIdAsync(int moduleId);
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace DigitalData.UserManager.Application
|
||||
/// <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>
|
||||
[Obsolete("Use MediatR")]
|
||||
public static IServiceCollection AddUserManagerApplication(this IServiceCollection services)
|
||||
=> services
|
||||
.AddAutoMapper(typeof(UserMappingProfile).Assembly)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.Base
|
||||
{
|
||||
// TODO: use getter - setter methods for a simple inheritance.
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public record BaseReadDto(int Id, string? AddedWho, DateTime? AddedWhen, string? ChangedWho, DateTime? ChangedWhen) : BaseDTO<int>(Id);
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.Base
|
||||
namespace DigitalData.UserManager.Application.DTOs.Base
|
||||
{
|
||||
public record BaseUpdateDto() : IUnique<int>
|
||||
public record BaseUpdateDto
|
||||
{
|
||||
|
||||
public string ChangedWho { get; set; } = "UNAUTHORIZED";
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.Group
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public record GroupReadDto
|
||||
(
|
||||
int Id,
|
||||
|
||||
@@ -4,6 +4,7 @@ using DigitalData.UserManager.Application.DTOs.User;
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public record GroupOfUserReadDto(
|
||||
int Id,
|
||||
int UserId,
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.Module
|
||||
namespace DigitalData.UserManager.Application.DTOs.Module
|
||||
{
|
||||
public record ModuleDto(
|
||||
int Id,
|
||||
string? Name,
|
||||
string? ShortName
|
||||
) : IUnique<int>;
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
|
||||
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserUpdateDto(
|
||||
int Id,
|
||||
@@ -9,5 +7,5 @@ namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
|
||||
bool? IsAdmin,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
) : IUnique<int>;
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using DigitalData.UserManager.Application.DTOs.User;
|
||||
|
||||
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public record UserRepReadDto(
|
||||
int Id,
|
||||
int? UserId,
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<PackageId>UserManager.Application</PackageId>
|
||||
<Version>3.1.3</Version>
|
||||
<Authors>Digital Data GmbH</Authors>
|
||||
<Company>Digital Data GmbH</Company>
|
||||
<Product>UserManager.Application</Product>
|
||||
@@ -14,8 +13,9 @@
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||
<PackageTags>digital data application user maanger</PackageTags>
|
||||
<AssemblyVersion>3.1.3</AssemblyVersion>
|
||||
<FileVersion>3.1.3</FileVersion>
|
||||
<Version>3.2.1</Version>
|
||||
<AssemblyVersion>3.2.1</AssemblyVersion>
|
||||
<FileVersion>3.2.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -26,10 +26,9 @@
|
||||
</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" />
|
||||
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.0.0" />
|
||||
<PackageReference Include="DigitalData.Core.Application" Version="3.3.4" />
|
||||
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="3.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class GroupMappingProfile : Profile
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public GroupMappingProfile()
|
||||
{
|
||||
CreateMap<Group, GroupCreateDto>();
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class GroupOfUserMappingProfile : Profile
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public GroupOfUserMappingProfile()
|
||||
{
|
||||
CreateMap<GroupOfUser, GroupOfUserCreateDto>();
|
||||
@@ -17,4 +18,4 @@ namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
CreateMap<GroupOfUserUpdateDto, GroupOfUser>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace DigitalData.UserManager.Application.MappingProfiles
|
||||
{
|
||||
public class UserRepMappingProfile : Profile
|
||||
{
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public UserRepMappingProfile()
|
||||
{
|
||||
CreateMap<UserRep, UserRepCreateDto>();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.Base;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
@@ -9,6 +9,7 @@ using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public class BaseService<TCRUDRepository, TCreateDto, TReadDto, TBaseEntity> : CRUDService<TCRUDRepository, TCreateDto, TReadDto, TBaseEntity, int>, IBaseService<TCreateDto, TReadDto, TBaseEntity>
|
||||
where TCRUDRepository : ICRUDRepository<TBaseEntity, int>
|
||||
where TCreateDto : BaseCreateDto
|
||||
@@ -25,7 +26,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
|
||||
public async Task<UserReadDto?> GetUserAsync() => _lazyUserAsync is null ? null : await _lazyUserAsync.Value;
|
||||
|
||||
public override async Task<DataResult<int>> CreateAsync(TCreateDto createDto)
|
||||
public override async Task<DataResult<TReadDto>> CreateAsync(TCreateDto createDto)
|
||||
{
|
||||
var user = await GetUserAsync();
|
||||
if(user is not null)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public class GroupOfUserService : BaseService<IGroupOfUserRepository, GroupOfUserCreateDto, GroupOfUserReadDto, GroupOfUser>, IGroupOfUserService
|
||||
{
|
||||
public GroupOfUserService(IGroupOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.Group;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public class GroupService : BaseService<IGroupRepository, GroupCreateDto, GroupReadDto, Group>, IGroupService
|
||||
{
|
||||
private readonly IStringLocalizer<Resource>? _localizer;
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public class ModuleOfUserService : CRUDService<IModuleOfUserRepository, ModuleOfUserCreateDto, ModuleOfUserReadDto, ModuleOfUser, int>, IModuleOfUserService
|
||||
{
|
||||
public ModuleOfUserService(IModuleOfUserRepository repository, IMapper mapper) : base(repository, mapper)
|
||||
|
||||
@@ -7,6 +7,7 @@ using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public class ModuleService : BasicCRUDService<IModuleRepository, ModuleDto, Module, int>, IModuleService
|
||||
{
|
||||
public ModuleService(IModuleRepository repository, IMapper mapper) : base(repository, mapper)
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public class UserRepService : BaseService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRep>, IUserRepService
|
||||
{
|
||||
private readonly IStringLocalizer<Resource>? _localizer;
|
||||
@@ -24,13 +25,13 @@ namespace DigitalData.UserManager.Application.Services
|
||||
return Result.Success(urReadDTOs);
|
||||
}
|
||||
|
||||
public override async Task<DataResult<int>> CreateAsync(UserRepCreateDto createDto)
|
||||
public override async Task<DataResult<UserRepReadDto>> 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)
|
||||
? Result.Fail<UserRepReadDto>().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)
|
||||
? Result.Fail<UserRepReadDto>().Notice(LogLevel.None, Flag.DataIntegrityIssue, _localizer?[Key.InvalidDateRange].Value)
|
||||
: await base.CreateAsync(createDto);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using DigitalData.Core.Abstraction.Application.DTO;
|
||||
|
||||
namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public class UserService : BaseService<IUserRepository, UserCreateDto, UserReadDto, User>, IUserService
|
||||
{
|
||||
private readonly IStringLocalizer<Resource>? _localizer;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<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>
|
||||
@@ -14,8 +13,9 @@
|
||||
<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>
|
||||
<Version>1.1.2</Version>
|
||||
<AssemblyVersion>1.1.2</AssemblyVersion>
|
||||
<FileVersion>1.1.2</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -25,6 +25,10 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DigitalData.UserManager.Application\DigitalData.UserManager.Application.csproj" />
|
||||
<ProjectReference Include="..\DigitalData.UserManager.Domain\DigitalData.UserManager.Domain.csproj" />
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace DigitalData.UserManager.DependencyInjection;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
[Obsolete("Use IRepository")]
|
||||
public static IServiceCollection AddUserManager<TDbContext>(this IServiceCollection services)
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
@@ -16,10 +17,11 @@ public static class Extensions
|
||||
return services;
|
||||
}
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public static IServiceCollection AddUserManager(this IServiceCollection services, Action<DbContextOptionsBuilder> optionsAction)
|
||||
{
|
||||
services.AddUserManagerInfrastructure(optionsAction);
|
||||
services.AddUserManagerApplication();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TargetFrameworks>net462;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<PackageId>UserManager.Domain</PackageId>
|
||||
<Version>3.0.2</Version>
|
||||
<Authors>Digital Data GmbH</Authors>
|
||||
<Company>Digital Data GmbH</Company>
|
||||
<Product>UserManager.Domain</Product>
|
||||
@@ -13,20 +10,46 @@
|
||||
<Copyright>Copyright 2024</Copyright>
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||
<PackageTags>digital data domain user maanger</PackageTags>
|
||||
<AssemblyVersion>3.0.2</AssemblyVersion>
|
||||
<FileVersion>3.0.2</FileVersion>
|
||||
<PackageTags>digital data domain user manager</PackageTags>
|
||||
<Version>3.2.3</Version>
|
||||
<AssemblyVersion>3.2.3</AssemblyVersion>
|
||||
<FileVersion>3.2.3</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
|
||||
<Nullable>disable</Nullable>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' != 'net462'">
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.16" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\Assets\icon.png">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath>\</PackagePath>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
#endif
|
||||
|
||||
namespace DigitalData.UserManager.Domain.Entities
|
||||
{
|
||||
public class BaseEntity : IUnique<int>
|
||||
public class BaseEntity
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
@@ -14,11 +16,19 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
|
||||
[StringLength(50)]
|
||||
[Column("ADDED_WHO")]
|
||||
public string? AddedWho { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
AddedWho { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
[Column("CHANGED_WHO")]
|
||||
public string? ChangedWho { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
ChangedWho { get; set; }
|
||||
|
||||
//TODO: assign it to default value in create dto, not here!
|
||||
[Column("ADDED_WHEN", TypeName = "datetime")]
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
#endif
|
||||
|
||||
namespace DigitalData.UserManager.Domain.Entities
|
||||
{
|
||||
[Table("TBDD_CLIENT_USER", Schema = "dbo")]
|
||||
public class ClientUser : IUnique<int>
|
||||
public class ClientUser
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
@@ -15,18 +17,26 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
|
||||
[Required]
|
||||
[Column("USER_ID")]
|
||||
public int UserId { get; init; }
|
||||
public int UserId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("CLIENT_ID")]
|
||||
public int ClientId { get; init; }
|
||||
public int ClientId { get; set; }
|
||||
|
||||
[Column("COMMENT")]
|
||||
public string? Comment { get; init; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Comment { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
[Column("ADDED_WHO")]
|
||||
public string? AddedWho { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
AddedWho { get; set; }
|
||||
|
||||
[Column("ADDED_WHEN", TypeName = "datetime")]
|
||||
[DefaultValue("GETDATE()")]
|
||||
|
||||
@@ -8,7 +8,11 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
public class Group : BaseEntity
|
||||
{
|
||||
[StringLength(50)]
|
||||
public string? Name { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Name { get; set; }
|
||||
|
||||
[Required]
|
||||
[DefaultValue(false)]
|
||||
@@ -24,12 +28,16 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
public bool Active { get; set; }
|
||||
|
||||
[StringLength(200)]
|
||||
public string? Comment { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Comment { get; set; }
|
||||
|
||||
// TODO: this column should be assigned by triggers. despite this it is not null and this is problem for creation. talk with others
|
||||
[Required]
|
||||
[Column("ECM_FK_ID")]
|
||||
[DefaultValue(-1)]
|
||||
public int EcmFkId { get; init; } = -1;
|
||||
public int EcmFkId { get; set; } = -1;
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,24 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
public int GroupId { get; set; }
|
||||
|
||||
[StringLength(200)]
|
||||
public string? Comment { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Comment { get; set; }
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual User? User { get; set; }
|
||||
public virtual User
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
User { get; set; }
|
||||
|
||||
[ForeignKey("GroupId")]
|
||||
public virtual Group? Group { get; set; }
|
||||
public virtual Group
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Group { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DigitalData.UserManager.Domain.Entities
|
||||
{
|
||||
[Table("TBDD_MODULES", Schema = "dbo")]
|
||||
public class Module : IUnique<int>
|
||||
public class Module
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
@@ -13,11 +12,19 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
public int Id { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
public string? Name { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Name { get; set; }
|
||||
|
||||
[StringLength(20)]
|
||||
[Column("SHORT_NAME")]
|
||||
public string? ShortName { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
ShortName { get; set; }
|
||||
|
||||
#region IGNORED COLUMNS
|
||||
//[Required]
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DigitalData.UserManager.Domain.Entities
|
||||
{
|
||||
[Table("TBDD_USER_MODULES", Schema = "dbo")]
|
||||
public class ModuleOfUser : IUnique<int>
|
||||
public class ModuleOfUser
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
@@ -22,21 +21,41 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
|
||||
[Column("COMMENT")]
|
||||
[StringLength(200)]
|
||||
public string? Comment { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Comment { get; set; }
|
||||
|
||||
[Column("ADDED_WHO")]
|
||||
[StringLength(50)]
|
||||
public string? AddedWho { get; set; } = "DEFAULT";
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
AddedWho { get; set; } = "DEFAULT";
|
||||
|
||||
[Column("CHANGED_WHO")]
|
||||
[StringLength(50)]
|
||||
public string? ChangedWho { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
ChangedWho { get; set; }
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual User? User { get; set; }
|
||||
public virtual User
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
User { get; set; }
|
||||
|
||||
[ForeignKey("ModuleId")]
|
||||
public virtual Module? Module { get; set; }
|
||||
public virtual Module
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Module { get; set; }
|
||||
|
||||
#region IGNORED COLUMNS
|
||||
//public bool IsAdmin { get; set; }
|
||||
@@ -54,5 +73,4 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
//public DateTime? ChangedWhen { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +1,74 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
#endif
|
||||
|
||||
namespace DigitalData.UserManager.Domain.Entities
|
||||
{
|
||||
[Table("TBDD_USER", Schema = "dbo")]
|
||||
public class User : BaseEntity
|
||||
public partial class User : BaseEntity
|
||||
{
|
||||
[Column("PRENAME")]
|
||||
[StringLength(50)]
|
||||
public string? Prename { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Prename { get; set; }
|
||||
|
||||
[Column("NAME")]
|
||||
[StringLength(50)]
|
||||
public string? Name { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Name { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("USERNAME")]
|
||||
[StringLength(50)]
|
||||
public string Username { get; set; }
|
||||
public
|
||||
#if NET7_0_OR_GREATER
|
||||
required
|
||||
#endif
|
||||
string Username { get; set; }
|
||||
|
||||
[Column("SHORTNAME")]
|
||||
[StringLength(30)]
|
||||
public string? Shortname { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Shortname
|
||||
{ get; set; }
|
||||
|
||||
[Column("EMAIL")]
|
||||
[StringLength(100)]
|
||||
public string? Email { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("LANGUAGE")]
|
||||
[StringLength(5)]
|
||||
[DefaultValue("de-DE")]
|
||||
public string Language { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Language { get; set; }
|
||||
|
||||
[Column("COMMENT")]
|
||||
[StringLength(500)]
|
||||
public string? Comment { get; set; }
|
||||
public string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Comment { get; set; }
|
||||
|
||||
[Column("DELETED")]
|
||||
public bool Deleted { get; set; }
|
||||
@@ -45,33 +77,51 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Column("DATE_FORMAT")]
|
||||
[StringLength(10)]
|
||||
[DefaultValue("dd.MM.yyyy")]
|
||||
public string DateFormat { get; set; }
|
||||
public
|
||||
#if NET7_0_OR_GREATER
|
||||
required
|
||||
#endif
|
||||
string DateFormat { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("ACTIVE")]
|
||||
public bool Active { get; set; }
|
||||
|
||||
#region IGNORED COLUMNS
|
||||
//[Required]
|
||||
//[Column("GENERAL_VIEWER")]
|
||||
//[StringLength(30)]
|
||||
//[DefaultValue("NONE")]
|
||||
//public string GeneralViewer { get; set; }
|
||||
[Required]
|
||||
[Column("GENERAL_VIEWER")]
|
||||
[StringLength(30)]
|
||||
[DefaultValue("NONE")]
|
||||
public
|
||||
#if NET7_0_OR_GREATER
|
||||
required
|
||||
#endif
|
||||
string GeneralViewer { get; set; }
|
||||
|
||||
//[Required]
|
||||
//[Column("WAN_ENVIRONMENT")]
|
||||
//public bool WanEnvironment { get; set; }
|
||||
[Required]
|
||||
[Column("WAN_ENVIRONMENT")]
|
||||
public bool WanEnvironment { get; set; }
|
||||
|
||||
//[Required]
|
||||
//[Column("USERID_FK_INT_ECM")]
|
||||
//public int UseridFkIntEcm { get; set; }
|
||||
[Required]
|
||||
[Column("USERID_FK_INT_ECM")]
|
||||
public int UserIdFkIntEcm { get; set; }
|
||||
|
||||
//[Column("DELETED_WHEN")]
|
||||
//public DateTime? DeletedWhen { get; set; }
|
||||
[Column("DELETED_WHEN")]
|
||||
public DateTime
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
DeletedWhen { get; set; }
|
||||
|
||||
//[Column("DELETED_WHO")]
|
||||
//[StringLength(50)]
|
||||
//public string? DeletedWho { get; set; }
|
||||
#endregion
|
||||
[Column("DELETED_WHO")]
|
||||
[StringLength(50)]
|
||||
public
|
||||
#if NET7_0_OR_GREATER
|
||||
required
|
||||
#endif
|
||||
string
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
# endif
|
||||
DeletedWho { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
#endif
|
||||
|
||||
namespace DigitalData.UserManager.Domain.Entities
|
||||
{
|
||||
@@ -25,15 +27,31 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
public DateTime? ValidTo { get; set; }
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual User? User { get; set; }
|
||||
public virtual User
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
User { get; set; }
|
||||
|
||||
[ForeignKey("RepGroupId")]
|
||||
public virtual Group? RepGroup { get; set; }
|
||||
public virtual Group
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
RepGroup { get; set; }
|
||||
|
||||
[ForeignKey("GroupId")]
|
||||
public virtual Group? Group { get; set; }
|
||||
public virtual Group
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
Group { get; set; }
|
||||
|
||||
[ForeignKey("RepUserId")]
|
||||
public virtual User? RepUser { get; set; }
|
||||
public virtual User
|
||||
#if NET7_0_OR_GREATER
|
||||
?
|
||||
#endif
|
||||
RepUser { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using DigitalData.UserManager.Application;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -16,6 +15,7 @@ public static class DependencyInjection
|
||||
/// <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>
|
||||
[Obsolete("Use IRepository")]
|
||||
public static IServiceCollection AddUserManagerInfrastructure<TDbContext>(this IServiceCollection services)
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
@@ -36,7 +36,8 @@ public static class DependencyInjection
|
||||
/// <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>
|
||||
[Obsolete("Use IRepository")]
|
||||
public static IServiceCollection AddUserManagerInfrastructure(this IServiceCollection services, Action<DbContextOptionsBuilder> optionsAction) => services
|
||||
.AddDbContext<UserManagerDbContext>(optionsAction)
|
||||
.AddUserManagerInfrastructure<UserManagerDbContext>();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<PackageId>UserManager.Infrastructure</PackageId>
|
||||
<Version>3.0.2</Version>
|
||||
<Authors>Digital Data GmbH</Authors>
|
||||
<Company>Digital Data GmbH</Company>
|
||||
<Product>UserManager.Infrastructure</Product>
|
||||
@@ -14,8 +13,9 @@
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
<RepositoryUrl>http://git.dd:3000/AppStd/WebUserManager.git</RepositoryUrl>
|
||||
<PackageTags>digital data infrastructure user maanger</PackageTags>
|
||||
<AssemblyVersion>3.0.2</AssemblyVersion>
|
||||
<FileVersion>3.0.2</FileVersion>
|
||||
<Version>3.1.1</Version>
|
||||
<AssemblyVersion>3.1.1</AssemblyVersion>
|
||||
<FileVersion>3.1.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -26,7 +26,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.0.1" />
|
||||
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.0.0" />
|
||||
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||
@@ -40,7 +41,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
[Obsolete("Use Repository")]
|
||||
public class ClientUserRepository<TDbContext> : CRUDRepository<ClientUser, int, TDbContext>, IClientUserRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using DigitalData.UserManager.Application.Contracts.Repositories;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
[Obsolete("Use Repository")]
|
||||
public class GroupOfUserRepository<TDbContext> : CRUDRepository<GroupOfUser, int, TDbContext>, IGroupOfUserRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
[Obsolete("Use Repository")]
|
||||
public class GroupRepository<TDbContext> : CRUDRepository<Group, int, TDbContext>, IGroupRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use Repository")]
|
||||
public class ModuleOfUserRepository<TDbContext> : CRUDRepository<ModuleOfUser, int, TDbContext>, IModuleOfUserRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use Repository")]
|
||||
public class ModuleRepository<TDbContext> : CRUDRepository<Module, int, TDbContext>, IModuleRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use Repository")]
|
||||
public class UserRepRepository<TDbContext> : CRUDRepository<UserRep, int, TDbContext>, IUserRepRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
{
|
||||
[Obsolete("Use Repository")]
|
||||
public class UserRepository<TDbContext> : CRUDRepository<User, int, TDbContext>, IUserRepository
|
||||
where TDbContext : DbContext, IUserManagerDbContext
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user