Entfernt das DataContracts-Projekt. Guid-Attribut umbenannt in Id mit Column-Attribut für jede Entität und dto.
This commit is contained in:
parent
b5bbfc9270
commit
f84a719dd4
@ -19,17 +19,13 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
{
|
||||
private IUserService _userService;
|
||||
private IGroupOfUserService _gouService;
|
||||
private IMemoryCache _memoryCache;
|
||||
private IConfiguration _configuration;
|
||||
private IDirectorySearchService _dirSearchService;
|
||||
private readonly IStringLocalizer<Resource> _localizer;
|
||||
|
||||
public AuthController(IUserService userService, IGroupOfUserService gouService, IMemoryCache memoryCache, IConfiguration configuration, IDirectorySearchService directorySearchService, IStringLocalizer<Resource> localizer)
|
||||
public AuthController(IUserService userService, IGroupOfUserService gouService, IDirectorySearchService directorySearchService, IStringLocalizer<Resource> localizer)
|
||||
{
|
||||
_userService = userService;
|
||||
_gouService = gouService;
|
||||
_memoryCache = memoryCache;
|
||||
_configuration = configuration;
|
||||
_dirSearchService = directorySearchService;
|
||||
_localizer = localizer;
|
||||
}
|
||||
@ -63,7 +59,7 @@ namespace DigitalData.UserManager.API.Controllers
|
||||
// Create claims
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim(ClaimTypes.NameIdentifier, user.Guid.ToString()),
|
||||
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
|
||||
new Claim(ClaimTypes.Name, user.Username),
|
||||
new Claim(ClaimTypes.Surname, user.Name ?? ""),
|
||||
new Claim(ClaimTypes.GivenName, user.Prename ?? ""),
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
using DigitalData.Core.API;
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.UserManager.Application.Contracts;
|
||||
using DigitalData.UserManager.Application.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{
|
||||
public record GroupReadDto
|
||||
(
|
||||
int Guid,
|
||||
int Id,
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
{
|
||||
public record GroupUpdateDto
|
||||
(
|
||||
int Guid,
|
||||
int Id,
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
|
||||
@ -4,7 +4,7 @@ using DigitalData.UserManager.Application.DTOs.User;
|
||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserReadDto(
|
||||
int Guid,
|
||||
int Id,
|
||||
int UserId,
|
||||
int GroupId,
|
||||
string? Comment,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserUpdateDto(
|
||||
int Guid,
|
||||
int Id,
|
||||
int? UserId,
|
||||
int? GroupId,
|
||||
string? Comment,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.Module
|
||||
{
|
||||
public record ModuleDto(
|
||||
int Guid,
|
||||
int Id,
|
||||
string? Name,
|
||||
string? ShortName
|
||||
);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserReadDto(
|
||||
int Guid,
|
||||
int Id,
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
string? Comment,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserUpdateDto(
|
||||
int Guid,
|
||||
int Id,
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
bool? IsAdmin,
|
||||
|
||||
@ -6,7 +6,7 @@ namespace DigitalData.UserManager.Application.DTOs.User
|
||||
{
|
||||
public record UserReadDto()
|
||||
{
|
||||
public int Guid { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Prename { get; set; }
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
namespace DigitalData.UserManager.Application.DTOs.User
|
||||
{
|
||||
public record UserUpdateDto(
|
||||
int Guid,
|
||||
int Id,
|
||||
string? Prename,
|
||||
string? Name,
|
||||
string? Username,
|
||||
|
||||
@ -4,7 +4,7 @@ using DigitalData.UserManager.Application.DTOs.User;
|
||||
namespace DigitalData.UserManager.Application.DTOs.UserRep
|
||||
{
|
||||
public record UserRepReadDto(
|
||||
int Guid,
|
||||
int Id,
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
|
||||
@ -21,7 +21,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
var group = _mapper.MapOrThrow<Group>(adGroup);
|
||||
|
||||
if (await HasEntity(group.Guid))
|
||||
if (await HasEntity(group.Id))
|
||||
return Result.Fail<int>().Message(_localizer[Key.GroupAlreadyExists.ToString()]);
|
||||
|
||||
var createdGroup = await _repository.CreateAsync(group);
|
||||
|
||||
@ -49,7 +49,7 @@ namespace DigitalData.UserManager.Application.Services
|
||||
{
|
||||
var user = _mapper.MapOrThrow<User>(upDto);
|
||||
|
||||
if (await HasEntity(user.Guid))
|
||||
if (await HasEntity(user.Id))
|
||||
return Result.Fail<int>().Message(_localizer[Key.UserAlreadyExists]);
|
||||
|
||||
var createdUser = await _repository.CreateAsync(user);
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Auth
|
||||
{
|
||||
public record AuthCheckDto (bool IsAuthenticated);
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Auth
|
||||
{
|
||||
public record LogInDto(string Username, string Password);
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Group
|
||||
{
|
||||
public record DirectoryGroupDto
|
||||
(
|
||||
IEnumerable<string> Samaccountname
|
||||
//public string Name { get; set; }
|
||||
//public string ObjectSid { get; set; }
|
||||
//public string ObjectCategory { get; set; }
|
||||
//public int SamAccountType { get; set; }
|
||||
//public string DistinguishedName { get; set; }
|
||||
//public int InstanceType { get; set; }
|
||||
//public string CN { get; set; }
|
||||
//public string ObjectClass { get; set; }
|
||||
//public DateTime WhenChanged { get; set; }
|
||||
//public Guid ObjectGuid { get; set; }
|
||||
//public long UsnCreated { get; set; }
|
||||
//public int? GroupType { get; set; }
|
||||
//public DateTime? DsCorePropagationData { get; set; }
|
||||
//public int? AdminCount { get; set; }
|
||||
//public int? SystemFlags { get; set; }
|
||||
//public string Member { get; set; }
|
||||
//public string AdsPath { get; set; }
|
||||
//public long UsnChanged { get; set; }
|
||||
//public DateTime WhenCreated { get; set; }
|
||||
//public string Description { get; set; }
|
||||
//public bool? IsCriticalSystemObject { get; set; }
|
||||
);
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Group
|
||||
{
|
||||
public record GroupCreateDto
|
||||
(
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Group
|
||||
{
|
||||
public record GroupReadDto
|
||||
(
|
||||
int Guid,
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Group
|
||||
{
|
||||
public record GroupUpdateDto
|
||||
(
|
||||
int Guid,
|
||||
string? Name,
|
||||
bool? AdSync,
|
||||
bool? Internal,
|
||||
bool? Active,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserCreateDto(
|
||||
int UserId,
|
||||
int GroupId,
|
||||
string? Comment,
|
||||
string? AddedWho
|
||||
);
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
using DigitalData.UserManager.DataContracts.DTOs.Group;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.User;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int GroupId,
|
||||
string? Comment,
|
||||
string AddedWho,
|
||||
string? ChangedWho,
|
||||
UserReadDto User,
|
||||
GroupReadDto Group
|
||||
);
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.GroupOfUser
|
||||
{
|
||||
public record GroupOfUserUpdateDto(
|
||||
int Guid,
|
||||
int? UserId,
|
||||
int? GroupId,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.Module
|
||||
{
|
||||
public record ModuleDto(
|
||||
int Guid,
|
||||
string? Name,
|
||||
string? ShortName
|
||||
);
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserCreateDto(
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
bool IsAdmin,
|
||||
string? Comment,
|
||||
string? AddedWho
|
||||
);
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
string? Comment,
|
||||
string? AddedWho,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.ModuleOfUser
|
||||
{
|
||||
public record ModuleOfUserUpdateDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int ModuleId,
|
||||
bool? IsAdmin,
|
||||
string? Comment,
|
||||
string? ChangedWho
|
||||
);
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs
|
||||
{
|
||||
public record SearchRootCreateDto(string? DirEntryUsername, string DirEntryPassword);
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record class UserCreateDto
|
||||
{
|
||||
public string? Prename { get; init; }
|
||||
public string? Name { get; init; }
|
||||
public string? Username { get; init; }
|
||||
public string? Shortname { get; init; }
|
||||
public string? Email { get; init; }
|
||||
public string Language { get; init; } = "de-DE";
|
||||
public string? Comment { get; init; }
|
||||
public bool? Deleted { get; init; }
|
||||
public string DateFormat { get; init; } = "dd.MM.yyyy";
|
||||
public string AddedWho { get; init; } = "DEFAULT";
|
||||
public string? ChangedWho { get; init; }
|
||||
public bool Active { get; init; } = true;
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record UserPrincipalDto
|
||||
(
|
||||
string SamAccountName,
|
||||
string GivenName,
|
||||
string? MiddleName,
|
||||
string Surname,
|
||||
string EmailAddress,
|
||||
string? AddedWho,
|
||||
string? DateFormat
|
||||
// Guid Guid,
|
||||
// string SId,
|
||||
// string EmployeeId,
|
||||
// string VoiceTelephoneNumber,
|
||||
// DateTime? AccountExpirationDate,
|
||||
// DateTime? AccountLockoutTime,
|
||||
// bool AllowReversiblePasswordEncryption,
|
||||
// int BadLogonCount,
|
||||
// bool DelegationPermitted,
|
||||
// bool? Enabled,
|
||||
// string HomeDirectory,
|
||||
// string HomeDrive,
|
||||
// DateTime? LastBadPasswordAttempt,
|
||||
// DateTime? LastLogon,
|
||||
// DateTime? LastPasswordSet,
|
||||
// bool PasswordNeverExpires,
|
||||
// bool PasswordNotRequired,
|
||||
// byte[] PermittedLogonTimes,
|
||||
// bool SmartcardLogonRequired,
|
||||
// bool UserCannotChangePassword
|
||||
);
|
||||
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record UserPrincipalReadDto
|
||||
(
|
||||
Guid Guid,
|
||||
string SId,
|
||||
string EmployeeId,
|
||||
string SamAccountName,
|
||||
string GivenName,
|
||||
string MiddleName,
|
||||
string Surname,
|
||||
string EmailAddress
|
||||
);
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record UserReadDto(
|
||||
int Guid,
|
||||
string? Prename,
|
||||
string? Name,
|
||||
string Username,
|
||||
string? Shortname,
|
||||
string? Email,
|
||||
string Language,
|
||||
string? Comment,
|
||||
bool Deleted,
|
||||
string DateFormat,
|
||||
string AddedWho,
|
||||
bool Active
|
||||
);
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.User
|
||||
{
|
||||
public record UserUpdateDto(
|
||||
int Guid,
|
||||
string? Prename,
|
||||
string? Name,
|
||||
string? Username,
|
||||
string? Shortname,
|
||||
string? Email,
|
||||
string? Language,
|
||||
string? Comment,
|
||||
bool? Deleted,
|
||||
string? DateFormat,
|
||||
string? AddedWho,
|
||||
string? ChangedWho,
|
||||
bool? Active
|
||||
);
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.UserRep
|
||||
{
|
||||
public record UserRepCreateDto(
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
string AddedWho,
|
||||
int RepUserId
|
||||
);
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
using DigitalData.UserManager.DataContracts.DTOs.Group;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.User;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.UserRep
|
||||
{
|
||||
public record UserRepReadDto(
|
||||
int Guid,
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
string AddedWho,
|
||||
int? RepUserId,
|
||||
UserReadDto? User,
|
||||
GroupReadDto? RepGroup,
|
||||
GroupReadDto? RightGroup,
|
||||
UserReadDto? RepUser
|
||||
);
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
namespace DigitalData.UserManager.DataContracts.DTOs.UserRep
|
||||
{
|
||||
public record UserRepUpdateDto(
|
||||
int UserId,
|
||||
int? RepGroupId,
|
||||
int RightGroupId,
|
||||
int RepUserId
|
||||
);
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<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.Domain\DigitalData.UserManager.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -1,16 +0,0 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.User;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class DirectoryMappingProfile : Profile
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "<Pending>")]
|
||||
public DirectoryMappingProfile()
|
||||
{
|
||||
CreateMap<UserPrincipal, UserPrincipalDto>();
|
||||
CreateMap<UserPrincipal, UserPrincipalReadDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.Group;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class GroupMappingProfile : Profile
|
||||
{
|
||||
public GroupMappingProfile()
|
||||
{
|
||||
CreateMap<Group, GroupCreateDto>();
|
||||
CreateMap<Group, GroupReadDto>();
|
||||
CreateMap<Group, GroupUpdateDto>();
|
||||
|
||||
CreateMap<GroupCreateDto, Group>();
|
||||
CreateMap<GroupReadDto, Group>();
|
||||
CreateMap<GroupUpdateDto, Group>();
|
||||
|
||||
CreateMap<DirectoryGroupDto, Group>()
|
||||
.ForMember(group => group.EcmFkId, opt => opt.MapFrom(adGroup => 1))
|
||||
.ForMember(group => group.AdSync, opt => opt.MapFrom(adGroup => true))
|
||||
.ForMember(group => group.Internal, opt => opt.MapFrom(adGroup => false))
|
||||
.ForMember(group => group.Active, opt => opt.MapFrom(adGroup => true))
|
||||
.ForMember(group => group.Name, opt => opt.MapFrom(adGroup => adGroup.Samaccountname.ElementAt(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.GroupOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class GroupOfUserMappingProfile : Profile
|
||||
{
|
||||
public GroupOfUserMappingProfile()
|
||||
{
|
||||
CreateMap<GroupOfUser, GroupOfUserCreateDto>();
|
||||
CreateMap<GroupOfUser, GroupOfUserReadDto>();
|
||||
CreateMap<GroupOfUser, GroupOfUserUpdateDto>();
|
||||
|
||||
CreateMap<GroupOfUserCreateDto, GroupOfUser>();
|
||||
CreateMap<GroupOfUserReadDto, GroupOfUser>();
|
||||
CreateMap<GroupOfUserUpdateDto, GroupOfUser>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.Module;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class ModuleMappingProfile : Profile
|
||||
{
|
||||
public ModuleMappingProfile()
|
||||
{
|
||||
CreateMap<Module, ModuleDto>();
|
||||
CreateMap<Module, ModuleDto>();
|
||||
CreateMap<Module, ModuleDto>();
|
||||
|
||||
CreateMap<ModuleDto, Module>();
|
||||
CreateMap<ModuleDto, Module>();
|
||||
CreateMap<ModuleDto, Module>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.ModuleOfUser;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class ModuleOfUserMappingProfile : Profile
|
||||
{
|
||||
public ModuleOfUserMappingProfile()
|
||||
{
|
||||
CreateMap<ModuleOfUser, ModuleOfUserCreateDto>();
|
||||
CreateMap<ModuleOfUser, ModuleOfUserReadDto>();
|
||||
CreateMap<ModuleOfUser, ModuleOfUserUpdateDto>();
|
||||
|
||||
CreateMap<ModuleOfUserCreateDto, ModuleOfUser>();
|
||||
CreateMap<ModuleOfUserReadDto, ModuleOfUser>();
|
||||
CreateMap<ModuleOfUserUpdateDto, ModuleOfUser>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.User;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class UserMappingProfile : Profile
|
||||
{
|
||||
public UserMappingProfile()
|
||||
{
|
||||
CreateMap<User, UserCreateDto>();
|
||||
CreateMap<User, UserReadDto>();
|
||||
CreateMap<User, UserUpdateDto>();
|
||||
|
||||
CreateMap<UserCreateDto, User>();
|
||||
CreateMap<UserReadDto, User>();
|
||||
CreateMap<UserUpdateDto, User>();
|
||||
|
||||
CreateMap<UserPrincipalDto, User>()
|
||||
.ForMember(user => user.Name, opt => opt.MapFrom(upDto => upDto.Surname))
|
||||
.ForMember(user => user.Prename, opt => opt.MapFrom(upDto => upDto.GivenName))
|
||||
.ForMember(user => user.Username, opt => opt.MapFrom(upDto => upDto.SamAccountName))
|
||||
.ForMember(user => user.Email, opt => opt.MapFrom(upDto => upDto.EmailAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.UserManager.DataContracts.DTOs.UserRep;
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
|
||||
namespace DigitalData.UserManager.DataContracts.MappingProfiles
|
||||
{
|
||||
public class UserRepMappingProfile : Profile
|
||||
{
|
||||
public UserRepMappingProfile()
|
||||
{
|
||||
CreateMap<UserRep, UserRepCreateDto>();
|
||||
CreateMap<UserRep, UserRepReadDto>();
|
||||
CreateMap<UserRep, UserRepUpdateDto>();
|
||||
|
||||
CreateMap<UserRepCreateDto, UserRep>();
|
||||
CreateMap<UserRepReadDto, UserRep>();
|
||||
CreateMap<UserRepUpdateDto, UserRep>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,9 +7,10 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Table("TBDD_GROUPS", Schema = "dbo")]
|
||||
public class Group
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Guid { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
@ -7,9 +7,10 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Table("TBDD_GROUPS_USER", Schema = "dbo")]
|
||||
public class GroupOfUser
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Guid { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("USER_ID")]
|
||||
|
||||
@ -6,9 +6,10 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Table("TBDD_MODULES", Schema = "dbo")]
|
||||
public class Module
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Guid { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
public string? Name { get; set; }
|
||||
|
||||
@ -6,9 +6,10 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Table("TBDD_USER_MODULES", Schema = "dbo")]
|
||||
public class ModuleOfUser
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Guid { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column("USER_ID")]
|
||||
[Required]
|
||||
|
||||
@ -7,9 +7,10 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Table("TBDD_USER", Schema = "dbo")]
|
||||
public class User
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Guid { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column("PRENAME")]
|
||||
[StringLength(50)]
|
||||
|
||||
@ -7,9 +7,10 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Table("TBDD_USER_REPRESENTATION", Schema = "dbo")]
|
||||
public class UserRep
|
||||
{
|
||||
[Column("GUID")]
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Guid { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("USER_ID")]
|
||||
|
||||
@ -19,7 +19,7 @@ namespace DigitalData.UserManager.Infrastructure
|
||||
|
||||
modelBuilder.Entity<Group>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_GROUPS_AFT_UPD"))
|
||||
.HasKey(group => group.Guid);
|
||||
.HasKey(group => group.Id);
|
||||
|
||||
modelBuilder.Entity<Module>()
|
||||
.ToTable(tb => tb.HasTrigger("TBDD_MODULE_AFT_UPD"));
|
||||
|
||||
@ -19,25 +19,25 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
public async Task<IEnumerable<User>> ReadByModuleIdAsync(int moduleId)
|
||||
{
|
||||
var mous = _moduleOfUserRepo.ReadByModuleId(moduleId).Select<ModuleOfUser, int>(mos => mos.UserId);
|
||||
return await _dbSet.Where<User>(u => mous.Contains(u.Guid)).ToListAsync();
|
||||
return await _dbSet.Where<User>(u => mous.Contains(u.Id)).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<User>> ReadByGroupIdAsync(int groupId)
|
||||
{
|
||||
var gous = _groupOfUserRepo.ReadByGroupId(groupId).Select(gou => gou.UserId);
|
||||
return await _dbSet.Where<User>(u => gous.Contains(u.Guid)).ToListAsync();
|
||||
return await _dbSet.Where<User>(u => gous.Contains(u.Id)).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<User>> ReadUnassignedByModuleIdAsync(int moduleId)
|
||||
{
|
||||
var mous = _moduleOfUserRepo.ReadByModuleId(moduleId).Select<ModuleOfUser, int>(mos => mos.UserId);
|
||||
return await _dbSet.Where<User>(u => !mous.Contains(u.Guid)).ToListAsync();
|
||||
return await _dbSet.Where<User>(u => !mous.Contains(u.Id)).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<User>> ReadUnassignedByGroupIdAsync(int groupId)
|
||||
{
|
||||
var gous = _groupOfUserRepo.ReadByGroupId(groupId).Select<GroupOfUser, int>(gou => gou.UserId);
|
||||
return await _dbSet.Where<User>(u => !gous.Contains(u.Guid)).ToListAsync();
|
||||
return await _dbSet.Where<User>(u => !gous.Contains(u.Id)).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<User?> ReadByUsernameAsync(string username)
|
||||
|
||||
@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.UserManager.NgW
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.UserManager.Infrastructure", "DigitalData.UserManager.Infrastructure\DigitalData.UserManager.Infrastructure.csproj", "{1DD81373-82F9-4872-95C6-888624DB1797}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.UserManager.DataContracts", "DigitalData.UserManager.DataContracts\DigitalData.UserManager.DataContracts.csproj", "{58E4815C-3EA0-4959-9F1A-5310A4CFD786}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -41,10 +39,6 @@ Global
|
||||
{1DD81373-82F9-4872-95C6-888624DB1797}.Debug|Any CPU.Build.0 = Debug|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
|
||||
{58E4815C-3EA0-4959-9F1A-5310A4CFD786}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{58E4815C-3EA0-4959-9F1A-5310A4CFD786}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{58E4815C-3EA0-4959-9F1A-5310A4CFD786}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{58E4815C-3EA0-4959-9F1A-5310A4CFD786}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user