Compare commits
5 Commits
4387d62865
...
197db1e08b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
197db1e08b | ||
|
|
cfd163a7a7 | ||
|
|
41900e8e06 | ||
|
|
c362cb30e1 | ||
|
|
1d8ae2c371 |
@@ -8,9 +8,9 @@ export interface UserRole {
|
|||||||
|
|
||||||
|
|
||||||
export const enum EN_UserRoles {
|
export const enum EN_UserRoles {
|
||||||
User = 'user',
|
User = 'sDigital Data - IIM-Benutzer',
|
||||||
Master = 'master',
|
Master = 'sDigital Data - IIM-Administratoren',
|
||||||
Admin = 'admin',
|
Admin = 'sDigital Data - IIM-Administratoren',
|
||||||
DepartmentMaster = 'departmentmaster',
|
DepartmentMaster = 'departmentmaster',
|
||||||
DepartmentUser = 'departmentuser'
|
DepartmentUser = 'departmentuser'
|
||||||
}
|
}
|
||||||
@@ -50,6 +50,7 @@ export class CoreUser extends BaseEntity {
|
|||||||
|
|
||||||
public isInRolle(role: string): boolean {
|
public isInRolle(role: string): boolean {
|
||||||
role = role?.toLowerCase();
|
role = role?.toLowerCase();
|
||||||
|
return this.roleList.toLowerCase().includes(role);
|
||||||
return (this.roleList && ((',' + this.roleList.replace(' ', '') + ',').toLowerCase().indexOf(',' + role + ',') > -1))
|
return (this.roleList && ((',' + this.roleList.replace(' ', '') + ',').toLowerCase().indexOf(',' + role + ',') > -1))
|
||||||
|| (this.webAppRoleList && ((',' + this.webAppRoleList.replace(' ', '') + ',').toLowerCase().indexOf(',' + role + ',') > -1));
|
|| (this.webAppRoleList && ((',' + this.webAppRoleList.replace(' ', '') + ',').toLowerCase().indexOf(',' + role + ',') > -1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class AdWebAppToWebAppRoleRepository : BaseRepository<AdWebAppToWebAppRole>
|
public class AdWebAppToWebAppRoleRepository : BaseRepository<AdWebAppToWebAppRole>
|
||||||
{
|
{
|
||||||
public AdWebAppToWebAppRoleRepository(WebApiContext context) : base(context)
|
public AdWebAppToWebAppRoleRepository(WebApiContext context, ILogger<AdWebAppToWebAppRoleRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class CostCentreRepository : BaseRepository<CostCentre>
|
public class CostCentreRepository : BaseRepository<CostCentre>
|
||||||
{
|
{
|
||||||
public CostCentreRepository(WebApiContext context) : base(context)
|
public CostCentreRepository(WebApiContext context, ILogger<CostCentreRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class DepartmentRepository : BaseRepository<Department>
|
public class DepartmentRepository : BaseRepository<Department>
|
||||||
{
|
{
|
||||||
public DepartmentRepository(WebApiContext context) : base(context)
|
public DepartmentRepository(WebApiContext context, ILogger<DepartmentRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class DepartmentToWebAppToEmployeeForWindreamRepository : BaseRepository<DepartmentToWebAppToEmployeeForWindream>
|
public class DepartmentToWebAppToEmployeeForWindreamRepository : BaseRepository<DepartmentToWebAppToEmployeeForWindream>
|
||||||
{
|
{
|
||||||
public DepartmentToWebAppToEmployeeForWindreamRepository(WebApiContext context) : base(context)
|
public DepartmentToWebAppToEmployeeForWindreamRepository(WebApiContext context, ILogger<DepartmentToWebAppToEmployeeForWindreamRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class DocumentArtRepository : BaseRepository<DocumentArt>
|
public class DocumentArtRepository : BaseRepository<DocumentArt>
|
||||||
{
|
{
|
||||||
public DocumentArtRepository(WebApiContext context) : base(context)
|
public DocumentArtRepository(WebApiContext context, ILogger<DocumentArtRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class DocumentArtToDepartmentRepository : BaseRepository<DocumentArtToDepartment>
|
public class DocumentArtToDepartmentRepository : BaseRepository<DocumentArtToDepartment>
|
||||||
{
|
{
|
||||||
public DocumentArtToDepartmentRepository(WebApiContext context) : base(context)
|
public DocumentArtToDepartmentRepository(WebApiContext context, ILogger<DocumentArtToDepartmentRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class EmployeeAttributeRepository : BaseRepository<EmployeeAttribute>
|
public class EmployeeAttributeRepository : BaseRepository<EmployeeAttribute>
|
||||||
{
|
{
|
||||||
public EmployeeAttributeRepository(WebApiContext context) : base(context)
|
public EmployeeAttributeRepository(WebApiContext context, ILogger<EmployeeAttributeRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class EmployeeRepository : BaseRepository<Employee>
|
public class EmployeeRepository : BaseRepository<Employee>
|
||||||
{
|
{
|
||||||
public EmployeeRepository(WebApiContext context) : base(context)
|
public EmployeeRepository(WebApiContext context, ILogger<EmployeeAttributeRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class EmployeeStatusRepository : BaseRepository<EmployeeStatus>
|
public class EmployeeStatusRepository : BaseRepository<EmployeeStatus>
|
||||||
{
|
{
|
||||||
public EmployeeStatusRepository(WebApiContext context) : base(context)
|
public EmployeeStatusRepository(WebApiContext context, ILogger<EmployeeStatusRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class EmployeeToAttributeRepository : BaseRepository<EmployeeToAttribute>
|
public class EmployeeToAttributeRepository : BaseRepository<EmployeeToAttribute>
|
||||||
{
|
{
|
||||||
public EmployeeToAttributeRepository(WebApiContext context) : base(context)
|
public EmployeeToAttributeRepository(WebApiContext context, ILogger<EmployeeToAttributeRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class EmployeeToDepartmentRepository : BaseRepository<EmployeeToDepartment>
|
public class EmployeeToDepartmentRepository : BaseRepository<EmployeeToDepartment>
|
||||||
{
|
{
|
||||||
public EmployeeToDepartmentRepository(WebApiContext context) : base(context)
|
public EmployeeToDepartmentRepository(WebApiContext context, ILogger<EmployeeToDepartmentRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using DAL.Models.Filters;
|
|||||||
using HRD.LDAPService;
|
using HRD.LDAPService;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -14,7 +15,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
private readonly LdapManager _ldapManager;
|
private readonly LdapManager _ldapManager;
|
||||||
|
|
||||||
public EmployeeToWebAppRepository(WebApiContext context, LdapManager ldapManager) : base(context)
|
public EmployeeToWebAppRepository(WebApiContext context, LdapManager ldapManager, ILogger<EmployeeToWebAppRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
_ldapManager = ldapManager;
|
_ldapManager = ldapManager;
|
||||||
}
|
}
|
||||||
@@ -107,7 +108,7 @@ namespace DAL.Repositories
|
|||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
WriteLogError($"An error occurred while '{action}' the '{employee.LoginName}' into '{groupSuffix}'.");
|
_logger.LogError($"An error occurred while '{action}' the '{employee.LoginName}' into '{groupSuffix}'.");
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class ProjectRepository : BaseRepository<Project>
|
public class ProjectRepository : BaseRepository<Project>
|
||||||
{
|
{
|
||||||
public ProjectRepository(WebApiContext context) : base(context)
|
public ProjectRepository(WebApiContext context, ILogger<ProjectRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class RangRepository : BaseRepository<Rang>
|
public class RangRepository : BaseRepository<Rang>
|
||||||
{
|
{
|
||||||
public RangRepository(WebApiContext context) : base(context)
|
public RangRepository(WebApiContext context, ILogger<RangRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class SubsidiaryRepository : BaseRepository<Subsidiary>
|
public class SubsidiaryRepository : BaseRepository<Subsidiary>
|
||||||
{
|
{
|
||||||
public SubsidiaryRepository(WebApiContext context) : base(context)
|
public SubsidiaryRepository(WebApiContext context, ILogger<SubsidiaryRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WebAppAdditionalRoleRepository : BaseRepository<WebAppAdditionalRole>
|
public class WebAppAdditionalRoleRepository : BaseRepository<WebAppAdditionalRole>
|
||||||
{
|
{
|
||||||
public WebAppAdditionalRoleRepository(WebApiContext context) : base(context)
|
public WebAppAdditionalRoleRepository(WebApiContext context, ILogger<WebAppAdditionalRoleRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class WebAppRepository : BaseRepository<WebApp>
|
public class WebAppRepository : BaseRepository<WebApp>
|
||||||
{
|
{
|
||||||
public WebAppRepository(WebApiContext context) : base(context)
|
public WebAppRepository(WebApiContext context, ILogger<WebAppRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL.Repositories
|
namespace DAL.Repositories
|
||||||
{
|
{
|
||||||
public class WebAppRoleRepository : BaseRepository<WebAppRole>
|
public class WebAppRoleRepository : BaseRepository<WebAppRole>
|
||||||
{
|
{
|
||||||
public WebAppRoleRepository(WebApiContext context) : base(context)
|
public WebAppRoleRepository(WebApiContext context, ILogger<WebAppRoleRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using DAL.Models.Filters;
|
|||||||
using HRD.LDAPService;
|
using HRD.LDAPService;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -14,7 +15,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
private readonly LdapManager _ldapManager;
|
private readonly LdapManager _ldapManager;
|
||||||
|
|
||||||
public WebAppToDepartmentRepository(WebApiContext context, LdapManager ldapManager) : base(context)
|
public WebAppToDepartmentRepository(WebApiContext context, LdapManager ldapManager, ILogger<WebAppToDepartmentRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
_ldapManager = ldapManager;
|
_ldapManager = ldapManager;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using DAL.Models.Filters;
|
|||||||
using HRD.LDAPService;
|
using HRD.LDAPService;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -14,7 +15,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
private readonly LdapManager _ldapManager;
|
private readonly LdapManager _ldapManager;
|
||||||
|
|
||||||
public WebAppToWebAppAdditionalRoleRepository(WebApiContext context, LdapManager ldapManager) : base(context)
|
public WebAppToWebAppAdditionalRoleRepository(WebApiContext context, LdapManager ldapManager, ILogger<WebAppToWebAppAdditionalRoleRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
_ldapManager = ldapManager;
|
_ldapManager = ldapManager;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WebAppToWebAppRoleRepository : BaseRepository<WebAppToWebAppRole>
|
public class WebAppToWebAppRoleRepository : BaseRepository<WebAppToWebAppRole>
|
||||||
{
|
{
|
||||||
public WebAppToWebAppRoleRepository(WebApiContext context) : base(context)
|
public WebAppToWebAppRoleRepository(WebApiContext context, ILogger<WebAppToWebAppRoleRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WindreamColumnsToDepartmentRepository : BaseRepository<WindreamColumnsToDepartment>
|
public class WindreamColumnsToDepartmentRepository : BaseRepository<WindreamColumnsToDepartment>
|
||||||
{
|
{
|
||||||
public WindreamColumnsToDepartmentRepository(WebApiContext context) : base(context)
|
public WindreamColumnsToDepartmentRepository(WebApiContext context, ILogger<WindreamColumnsToDepartmentRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WindreamIndexRepository : BaseRepository<WindreamIndex>
|
public class WindreamIndexRepository : BaseRepository<WindreamIndex>
|
||||||
{
|
{
|
||||||
public WindreamIndexRepository(WebApiContext context) : base(context)
|
public WindreamIndexRepository(WebApiContext context, ILogger<WindreamIndexRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WindreamIndexToWindreamSearchToDepartmentRepository : BaseRepository<WindreamIndexToWindreamSearchToDepartment>
|
public class WindreamIndexToWindreamSearchToDepartmentRepository : BaseRepository<WindreamIndexToWindreamSearchToDepartment>
|
||||||
{
|
{
|
||||||
public WindreamIndexToWindreamSearchToDepartmentRepository(WebApiContext context) : base(context)
|
public WindreamIndexToWindreamSearchToDepartmentRepository(WebApiContext context, ILogger<WindreamIndexToWindreamSearchToDepartmentRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WindreamInputFolderRepository : BaseRepository<WindreamInputFolder>
|
public class WindreamInputFolderRepository : BaseRepository<WindreamInputFolder>
|
||||||
{
|
{
|
||||||
public WindreamInputFolderRepository(WebApiContext context) : base(context)
|
public WindreamInputFolderRepository(WebApiContext context, ILogger<WindreamInputFolderRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WindreamSearchItemRepository : BaseRepository<WindreamSearchItem>
|
public class WindreamSearchItemRepository : BaseRepository<WindreamSearchItem>
|
||||||
{
|
{
|
||||||
public WindreamSearchItemRepository(WebApiContext context) : base(context)
|
public WindreamSearchItemRepository(WebApiContext context, ILogger<WindreamSearchItemRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WindreamSearchItemToWindreamSearchToDepartmentRepository : BaseRepository<WindreamSearchItemToWindreamSearchToDepartment>
|
public class WindreamSearchItemToWindreamSearchToDepartmentRepository : BaseRepository<WindreamSearchItemToWindreamSearchToDepartment>
|
||||||
{
|
{
|
||||||
public WindreamSearchItemToWindreamSearchToDepartmentRepository(WebApiContext context) : base(context)
|
public WindreamSearchItemToWindreamSearchToDepartmentRepository(WebApiContext context, ILogger<WindreamSearchItemToWindreamSearchToDepartmentRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WindreamSearchRepository : BaseRepository<WindreamSearch>
|
public class WindreamSearchRepository : BaseRepository<WindreamSearch>
|
||||||
{
|
{
|
||||||
public WindreamSearchRepository(WebApiContext context) : base(context)
|
public WindreamSearchRepository(WebApiContext context, ILogger<WindreamSearchRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using DAL.Models.Entities;
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,7 +11,7 @@ namespace DAL.Repositories
|
|||||||
{
|
{
|
||||||
public class WindreamSearchToDepartmentRepository : BaseRepository<WindreamSearchToDepartment>
|
public class WindreamSearchToDepartmentRepository : BaseRepository<WindreamSearchToDepartment>
|
||||||
{
|
{
|
||||||
public WindreamSearchToDepartmentRepository(WebApiContext context) : base(context)
|
public WindreamSearchToDepartmentRepository(WebApiContext context, ILogger<WindreamSearchToDepartmentRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,24 @@
|
|||||||
using DAL._Shared.SharedModels;
|
using DAL._Shared.SharedModels;
|
||||||
using DAL.Models.Entities;
|
using DAL.Models.Entities;
|
||||||
using HRD.WebApi.DAL;
|
using HRD.WebApi.DAL;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using System.Collections;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using Microsoft.Extensions.Options;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace DAL
|
namespace DAL
|
||||||
{
|
{
|
||||||
public partial class WebApiContext : WebApiBaseContext
|
public partial class WebApiContext : WebApiBaseContext
|
||||||
{
|
{
|
||||||
public WebApiContext(DbContextOptions<WebApiContext> options) : base(options)
|
private readonly WebApiContextOptions _options;
|
||||||
|
|
||||||
|
private readonly ILogger<WebApiContext> _logger;
|
||||||
|
|
||||||
|
public WebApiContext(DbContextOptions<WebApiContext> options, IOptions<WebApiContextOptions> webApiContextOptions, ILogger<WebApiContext> logger) : base(options)
|
||||||
{
|
{
|
||||||
|
_options = webApiContextOptions.Value;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual DbSet<WebAppUser> WebAppUserSet { get; set; }
|
public virtual DbSet<WebAppUser> WebAppUserSet { get; set; }
|
||||||
@@ -48,7 +53,333 @@ namespace DAL
|
|||||||
public virtual DbSet<WindreamSearchToDepartment> WindreamSearchToDepartmentSet { get; set; }
|
public virtual DbSet<WindreamSearchToDepartment> WindreamSearchToDepartmentSet { get; set; }
|
||||||
public virtual DbSet<WindreamInputFolder> WindreamInputFolderSet { get; set; }
|
public virtual DbSet<WindreamInputFolder> WindreamInputFolderSet { get; set; }
|
||||||
public virtual DbSet<Subsidiary> SubsidiarySet { get; set; }
|
public virtual DbSet<Subsidiary> SubsidiarySet { get; set; }
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
switch(_options.TableNamingRule)
|
||||||
|
{
|
||||||
|
case "DIGITAL_DATA":
|
||||||
|
OnModelCreating_DDSQLNaming(modelBuilder);
|
||||||
|
break;
|
||||||
|
case "PREPARED-SQL":
|
||||||
|
OnModelCreating_PreparedSQL(modelBuilder);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_logger.LogWarning($"The WebApiContextOptions.TableNamingRule is set to {_options?.TableNamingRule ?? "NULL"} in appsettings.json. Hence, it has been defaulted to PREPARED-SQL.");
|
||||||
|
OnModelCreating_PreparedSQL(modelBuilder);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void OnModelCreating_PreparedSQL(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<Subsidiary>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Subsidiary", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamInputFolder>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamInputFolder", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamSearchToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamSearchToDepartment", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamSearchItemToWindreamSearchToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamSearchItemToWindreamSearchToDepartment", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamSearchItem>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamSearchItem", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamSearch>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamSearch", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamIndexToWindreamSearchToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamIndexToWindreamSearchToDepartment", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamIndex>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamIndex", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
// 'WindreamColumnsToDepartment' tablosu güncellenmiş listeye dahil değil
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppToWebAppRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppToWebAppRole", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppToWebAppAdditionalRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppToWebAppAdditionalRole", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppToDepartment", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppAdditionalRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppAdditionalRole", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeToWebApp>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeToWebApp", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeToDepartment", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeToAttribute>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeToAttribute", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Employee>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Employee", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DocumentArtToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DocumentArtToDepartment", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
// 'DepartmentToWebAppToEmployeeForWindream' tablosu güncellenmiş listeye dahil değil
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppRole", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebApp>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebApp", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Rang>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Rang", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Project>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Project", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeStatus>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeStatus", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeAttribute>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeAttribute", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DocumentArt>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DocumentArt", "ecm");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Department>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Department", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<CostCentre>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("CostCentre", "hr");
|
||||||
|
});
|
||||||
|
|
||||||
|
// 'AdWebAppToWebAppRole' tablosu güncellenmiş listeye dahil değil
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppUser>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppUser", "dbo");
|
||||||
|
});
|
||||||
|
|
||||||
|
// 'WebAppEmployeeInfo' tablosu güncellenmiş listeye dahil değil
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static void OnModelCreating_ClassName(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<Subsidiary>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Subsidiary", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamInputFolder>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamInputFolder", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamSearchToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamSearchToDepartment", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamSearchItemToWindreamSearchToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamSearchItemToWindreamSearchToDepartment", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamSearchItem>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamSearchItem", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamSearch>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamSearch", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamIndexToWindreamSearchToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamIndexToWindreamSearchToDepartment", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamIndex>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamIndex", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WindreamColumnsToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WindreamColumnsToDepartment", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppToWebAppRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppToWebAppRole", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppToWebAppAdditionalRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppToWebAppAdditionalRole", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppToDepartment", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppAdditionalRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppAdditionalRole", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeToWebApp>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeToWebApp", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeToDepartment", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeToAttribute>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeToAttribute", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Employee>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Employee", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DocumentArtToDepartment>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DocumentArtToDepartment", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DepartmentToWebAppToEmployeeForWindream>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DepartmentToWebAppToEmployeeForWindream", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppRole", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebApp>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebApp", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Rang>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Rang", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Project>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Project", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeStatus>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeStatus", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EmployeeAttribute>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("EmployeeAttribute", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DocumentArt>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DocumentArt", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Department>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("Department", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<CostCentre>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("CostCentre", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<AdWebAppToWebAppRole>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("AdWebAppToWebAppRole", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppUser>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppUser", "webapi");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<WebAppEmployeeInfo>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("WebAppEmployeeInfo", "webapi");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#region MODEL CREATIN FOR DIGIDAL-DATA NAMING
|
||||||
|
protected static void OnModelCreating_DDSQLNaming(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.Entity<Subsidiary>(entity =>
|
modelBuilder.Entity<Subsidiary>(entity =>
|
||||||
{
|
{
|
||||||
@@ -206,11 +537,9 @@ namespace DAL
|
|||||||
});
|
});
|
||||||
|
|
||||||
Configure4DDNaming(modelBuilder.Model.GetEntityTypes().ToArray());
|
Configure4DDNaming(modelBuilder.Model.GetEntityTypes().ToArray());
|
||||||
|
|
||||||
base.OnModelCreating(modelBuilder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Configure4DDNaming(params IMutableEntityType[] entityTypes)
|
private static void Configure4DDNaming(params IMutableEntityType[] entityTypes)
|
||||||
{
|
{
|
||||||
foreach (var entityType in entityTypes)
|
foreach (var entityType in entityTypes)
|
||||||
{
|
{
|
||||||
@@ -233,5 +562,6 @@ namespace DAL
|
|||||||
var startUnderscores = System.Text.RegularExpressions.Regex.Match(input, @"^_+");
|
var startUnderscores = System.Text.RegularExpressions.Regex.Match(input, @"^_+");
|
||||||
return startUnderscores + System.Text.RegularExpressions.Regex.Replace(input, @"([a-z0-9])([A-Z])", "$1_$2").ToUpper();
|
return startUnderscores + System.Text.RegularExpressions.Regex.Replace(input, @"([a-z0-9])([A-Z])", "$1_$2").ToUpper();
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
DAL/WebApiContextOptions.cs
Normal file
9
DAL/WebApiContextOptions.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace DAL
|
||||||
|
{
|
||||||
|
#nullable enable
|
||||||
|
public class WebApiContextOptions
|
||||||
|
{
|
||||||
|
public string? TableNamingRule { get; init; } = null;
|
||||||
|
}
|
||||||
|
#nullable restore
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using HRD.LDAPService;
|
using HRD.LDAPService;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -11,7 +12,7 @@ namespace DAL._Shared.SharedRepositories
|
|||||||
public class WebAppEmployeeInfoRepository : BaseRepository<WebAppEmployeeInfo>
|
public class WebAppEmployeeInfoRepository : BaseRepository<WebAppEmployeeInfo>
|
||||||
|
|
||||||
{
|
{
|
||||||
public WebAppEmployeeInfoRepository(WebApiContext context) : base(context)
|
public WebAppEmployeeInfoRepository(WebApiContext context, ILogger<WebAppEmployeeInfoRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using DAL._Shared.SharedModels;
|
using DAL._Shared.SharedModels;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace DAL._Shared.SharedRepositories
|
namespace DAL._Shared.SharedRepositories
|
||||||
{
|
{
|
||||||
public class WebAppUserRepository : BaseRepository<WebAppUser>
|
public class WebAppUserRepository : BaseRepository<WebAppUser>
|
||||||
{
|
{
|
||||||
public WebAppUserRepository(WebApiContext context) : base(context)
|
public WebAppUserRepository(WebApiContext context, ILogger<WebAppUserRepository> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,255 +0,0 @@
|
|||||||
using HRD.AppLogger;
|
|
||||||
using NLog;
|
|
||||||
using NLog.Config;
|
|
||||||
using NLog.Targets;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace HRD.AppLogger
|
|
||||||
{
|
|
||||||
public enum EN_LoggingLevel
|
|
||||||
{
|
|
||||||
Trace = 1,
|
|
||||||
Debug = 2,
|
|
||||||
Info = 3,
|
|
||||||
Warn = 4,
|
|
||||||
Error = 5,
|
|
||||||
Fatal = 6,
|
|
||||||
Off = 7
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class AppLoggerConfig
|
|
||||||
{
|
|
||||||
private static readonly string DBLOG_CommandText =
|
|
||||||
@"
|
|
||||||
INSERT INTO dbo.DBLog
|
|
||||||
( MachineName,
|
|
||||||
Application,
|
|
||||||
Logged,
|
|
||||||
Level,
|
|
||||||
Message,
|
|
||||||
Logger,
|
|
||||||
CallSite,
|
|
||||||
Webrequest,
|
|
||||||
Stacktrace,
|
|
||||||
InnerException,
|
|
||||||
Exception,
|
|
||||||
Version,
|
|
||||||
Entity
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
( @machineName,
|
|
||||||
@application,
|
|
||||||
@logged,
|
|
||||||
@level,
|
|
||||||
@message,
|
|
||||||
@logger,
|
|
||||||
@callsite,
|
|
||||||
iif(@webrequestaction='',@webrequest, concat(@webrequest,' | action:',@webrequestaction)),
|
|
||||||
@stacktrace,
|
|
||||||
@innerException,
|
|
||||||
@exception,
|
|
||||||
@Version,
|
|
||||||
@Entity
|
|
||||||
);";
|
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> DBLOG_Parameters = new Dictionary<string, string>() {
|
|
||||||
//Globals
|
|
||||||
{"@version", "${gdc:item=Version}"},
|
|
||||||
{"@application", "${gdc:item=Application}"},
|
|
||||||
|
|
||||||
//Local
|
|
||||||
//{"@webrequest", "${mdlc:item=Webrequest}"},
|
|
||||||
{"@entity", "${mdlc:item=Entity}"},
|
|
||||||
|
|
||||||
//WebApi
|
|
||||||
{"@webrequest", "${aspnet-request-url}"},
|
|
||||||
{"@webrequestaction", "${aspnet-mvc-action}"},
|
|
||||||
|
|
||||||
//Nlog
|
|
||||||
{"@machineName", "${machinename}" },
|
|
||||||
{"@logged", "${date}"},
|
|
||||||
{"@level", "${level:upperCase=true}"},
|
|
||||||
{"@message", "${message}"},
|
|
||||||
{"@logger", "${logger}"},
|
|
||||||
{"@callSite", "${callsite:fileName=true:includeSourcePath=false:skipFrames=1}"}, //{"@callSite", "${callsite:filename=false:className=true:methodName=true}"},
|
|
||||||
{"@stacktrace", "${stacktrace:topFrames=10}"},
|
|
||||||
{"@InnerException", "${exception:format=Message,StackTrace,Data:maxInnerExceptionLevel=10}"},
|
|
||||||
{"@Exception", "${exception:format=ToString}"},
|
|
||||||
};
|
|
||||||
|
|
||||||
public static string AssemblyName { get; set; }
|
|
||||||
public static string AssemblyVersion { get; set; }
|
|
||||||
public static EN_LoggingLevel DBLogLevel { get; set; } = EN_LoggingLevel.Warn;
|
|
||||||
public static EN_LoggingLevel FileLogLevel { get; set; } = EN_LoggingLevel.Error;
|
|
||||||
public static string LogDirectory { get; set; } = String.Empty;
|
|
||||||
public static string NlogConnectionstring { get; set; }
|
|
||||||
public static LogLevel NlogDBLogLevel { get; set; }
|
|
||||||
public static LogLevel NlogFileLogLevel { get; set; }
|
|
||||||
public static NlogSentryConfig NlogSentryConfig { get; set; } = new NlogSentryConfig();
|
|
||||||
|
|
||||||
public static LoggingConfiguration CreateConfig()
|
|
||||||
{
|
|
||||||
NlogDBLogLevel = MapLogLevel(DBLogLevel);
|
|
||||||
NlogFileLogLevel = MapLogLevel(FileLogLevel);
|
|
||||||
|
|
||||||
var config = new LoggingConfiguration();
|
|
||||||
|
|
||||||
DatabaseTarget dbTarget = CreateDatabaseTarget(config);
|
|
||||||
var dbRule = new LoggingRule("*", NlogDBLogLevel, dbTarget);
|
|
||||||
config.LoggingRules.Add(dbRule);
|
|
||||||
|
|
||||||
//Rules
|
|
||||||
FileTarget targetFile = CreateFileTarget(config);
|
|
||||||
var rule = new LoggingRule("*", NlogFileLogLevel, targetFile);
|
|
||||||
config.LoggingRules.Add(rule);
|
|
||||||
if (NlogSentryConfig.NlogSentryIsEnable)
|
|
||||||
{
|
|
||||||
AddSentry(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Init(
|
|
||||||
string assemblyName,
|
|
||||||
string assemblyVersion,
|
|
||||||
EN_LoggingLevel dbLogLevel = EN_LoggingLevel.Warn
|
|
||||||
, EN_LoggingLevel fileLoogLevel = EN_LoggingLevel.Off
|
|
||||||
, string logDirectory = "")
|
|
||||||
{
|
|
||||||
AssemblyVersion = assemblyVersion;
|
|
||||||
AssemblyName = assemblyName;
|
|
||||||
DBLogLevel = dbLogLevel;
|
|
||||||
FileLogLevel = fileLoogLevel;
|
|
||||||
LogDirectory = logDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void AddSentry(LoggingConfiguration config)
|
|
||||||
{
|
|
||||||
config.AddSentry(o =>
|
|
||||||
{
|
|
||||||
o.Dsn = NlogSentryConfig.Dsn;
|
|
||||||
|
|
||||||
o.Layout = "${message}";
|
|
||||||
|
|
||||||
o.BreadcrumbLayout = "${logger}: ${message} #url: ${aspnet-request-url} | #action: ${aspnet-mvc-action}";
|
|
||||||
// Optionally specify a separate format for breadcrumbs
|
|
||||||
|
|
||||||
o.MinimumBreadcrumbLevel = NlogSentryConfig.MinimumBreadcrumbLevel; // Debug and higher are stored as breadcrumbs (default is Info)
|
|
||||||
o.MinimumEventLevel = NlogSentryConfig.MinimumEventLevel; // Error and higher is sent as event (default is Error)
|
|
||||||
|
|
||||||
// If DSN is not set, the SDK will look for an environment variable called SENTRY_DSN. If
|
|
||||||
// nothing is found, SDK is disabled.
|
|
||||||
|
|
||||||
o.AttachStacktrace = NlogSentryConfig.AttachStacktrace;
|
|
||||||
o.SendDefaultPii = NlogSentryConfig.SendDefaultPii; // Send Personal Identifiable information like the username of the user logged in to the device
|
|
||||||
|
|
||||||
o.IncludeEventDataOnBreadcrumbs = NlogSentryConfig.IncludeEventDataOnBreadcrumbs; // Optionally include event properties with breadcrumbs
|
|
||||||
o.ShutdownTimeoutSeconds = 5;
|
|
||||||
o.TracesSampleRate = 0.3;
|
|
||||||
|
|
||||||
//Optionally specify user properties via NLog (here using MappedDiagnosticsLogicalContext as an example)
|
|
||||||
// o.User = new SentryNLogUser
|
|
||||||
// {
|
|
||||||
// Id = "${mdlc:item=id}",
|
|
||||||
// Username = "${mdlc:item=username}",
|
|
||||||
// Email = "${mdlc:item=email}",
|
|
||||||
// IpAddress = "${mdlc:item=ipAddress}",
|
|
||||||
// Other =
|
|
||||||
//{
|
|
||||||
// new TargetPropertyWithContext("mood", "joyous")
|
|
||||||
//},
|
|
||||||
//};
|
|
||||||
|
|
||||||
o.AddTag("Backend", "${gdc:item=Application}"); // Send the logger name as a tag
|
|
||||||
o.AddTag("BackendVersion", "${gdc:item=Version}"); // Send the logger name as a tag
|
|
||||||
o.AddTag("logger", "${logger}"); // Send the logger name as a tag
|
|
||||||
|
|
||||||
// Other configuration
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DatabaseTarget CreateDatabaseTarget(LoggingConfiguration config)
|
|
||||||
{
|
|
||||||
var dbTarget = new DatabaseTarget
|
|
||||||
{
|
|
||||||
ConnectionString = NlogConnectionstring,
|
|
||||||
|
|
||||||
CommandText = DBLOG_CommandText
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var item in DBLOG_Parameters)
|
|
||||||
{
|
|
||||||
dbTarget.Parameters.Add(new DatabaseParameterInfo(item.Key, item.Value));
|
|
||||||
}
|
|
||||||
|
|
||||||
config.AddTarget("database", dbTarget);
|
|
||||||
return dbTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static FileTarget CreateFileTarget(LoggingConfiguration config)
|
|
||||||
{
|
|
||||||
var targetFile =
|
|
||||||
new FileTarget
|
|
||||||
{
|
|
||||||
FileName = Path.Combine(
|
|
||||||
!string.IsNullOrEmpty(LogDirectory) ? LogDirectory : "${basedir}/_logs/",
|
|
||||||
"${gdc:item=Application}" + "_V." + "${gdc:item=Version}" + $"_{DateTime.Now:yyyyMMdd}.log"),
|
|
||||||
Layout = "${date}|${uppercase:${level}}|${stacktrace}|${message}" +
|
|
||||||
"|${exception:format=Message,StackTrace,Data:maxInnerExceptionLevel=10}" +
|
|
||||||
"${event-properties:item=EventId.Id}"
|
|
||||||
};
|
|
||||||
|
|
||||||
config.AddTarget("logfile", targetFile);
|
|
||||||
return targetFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static LogLevel MapLogLevel(EN_LoggingLevel loggingLevel)
|
|
||||||
{
|
|
||||||
LogLevel logLevel = LogLevel.Error;
|
|
||||||
switch (loggingLevel)
|
|
||||||
{
|
|
||||||
case EN_LoggingLevel.Trace:
|
|
||||||
logLevel = LogLevel.Trace;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EN_LoggingLevel.Debug:
|
|
||||||
logLevel = LogLevel.Debug;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EN_LoggingLevel.Info:
|
|
||||||
logLevel = LogLevel.Info;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EN_LoggingLevel.Warn:
|
|
||||||
logLevel = LogLevel.Warn;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EN_LoggingLevel.Error:
|
|
||||||
logLevel = LogLevel.Error;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EN_LoggingLevel.Fatal:
|
|
||||||
logLevel = LogLevel.Fatal;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EN_LoggingLevel.Off:
|
|
||||||
logLevel = LogLevel.Off;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return logLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetSentryUser(int id, string login, string email, IDictionary<string, string> others = null)
|
|
||||||
{
|
|
||||||
NlogSentryConfig.SentryUser = new Sentry.User { Id = id.ToString(), Username = login, Email = email };
|
|
||||||
if (others != null) NlogSentryConfig.SentryUser.Other = others;
|
|
||||||
Sentry.SentrySdk.ConfigureScope(scope => { scope.User = NlogSentryConfig.SentryUser; });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace HRD.AppLogger
|
|
||||||
{
|
|
||||||
public interface ILoggerManager
|
|
||||||
{
|
|
||||||
void LogDebug(string message, string entityMessage = null, string webrequest = null, string userLogin = null);
|
|
||||||
|
|
||||||
void LogError(string message, string entityMessage = null, string webrequest = null, string userLogin = null);
|
|
||||||
|
|
||||||
void LogInfo(string message, string entityMessage = null, string webrequest = null, string userLogin = null);
|
|
||||||
|
|
||||||
void LogWarn(string message, string entityMessage = null, string webrequest = null, string userLogin = null);
|
|
||||||
|
|
||||||
void LogException(Exception exception, string entityMessage = null, string webrequest = null, string userLogin = null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
using NLog;
|
|
||||||
using Sentry;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace HRD.AppLogger
|
|
||||||
{
|
|
||||||
public class LoggerManager : ILoggerManager
|
|
||||||
{
|
|
||||||
private static readonly ILogger logger = LogManager.GetCurrentClassLogger();
|
|
||||||
|
|
||||||
public LoggerManager(bool throwExceptions = true) : this()
|
|
||||||
{
|
|
||||||
LogManager.ThrowExceptions = throwExceptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoggerManager()
|
|
||||||
{
|
|
||||||
GlobalDiagnosticsContext.Set("Version", AppLoggerConfig.AssemblyVersion);
|
|
||||||
GlobalDiagnosticsContext.Set("Application", AppLoggerConfig.AssemblyName);
|
|
||||||
|
|
||||||
LogManager.ThrowConfigExceptions = true;
|
|
||||||
LogManager.ThrowExceptions = false;
|
|
||||||
LogManager.Configuration = AppLoggerConfig.CreateConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WriteLog(Action<Object> log, Object message, string entityMessage = null, string webrequest = null, string userLogin = null)
|
|
||||||
{
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Entity", !String.IsNullOrEmpty(entityMessage) ? entityMessage : "");
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Webrequest", !String.IsNullOrEmpty(webrequest) ? webrequest : "");
|
|
||||||
|
|
||||||
if (AppLoggerConfig.NlogSentryConfig.NlogSentryIsEnable)
|
|
||||||
{
|
|
||||||
SentrySdk.WithScope(scope =>
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(entityMessage))
|
|
||||||
{
|
|
||||||
scope.SetTag("Entity", entityMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(webrequest))
|
|
||||||
{
|
|
||||||
scope.SetTag("Webrequest", webrequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(userLogin))
|
|
||||||
{
|
|
||||||
scope.SetTag("UserLogin", userLogin);
|
|
||||||
}
|
|
||||||
|
|
||||||
log(message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else log(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogDebug(string message, string entityMessage = null, string webrequest = null, string userLogin = null)
|
|
||||||
{
|
|
||||||
WriteLog(logger.Debug, message, entityMessage, webrequest, userLogin);
|
|
||||||
|
|
||||||
/* MappedDiagnosticsLogicalContext.Set("Entity", !String.IsNullOrEmpty(entityMessage) ? entityMessage : "");
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Webrequest", !String.IsNullOrEmpty(webrequest) ? webrequest : "");
|
|
||||||
|
|
||||||
if (AppLoggerConfig.NlogSentryConfig.NlogSentryIsEnable)
|
|
||||||
{
|
|
||||||
SentrySdk.WithScope(scope =>
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(entityMessage))
|
|
||||||
{
|
|
||||||
scope.SetTag("Entity", entityMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(webrequest))
|
|
||||||
{
|
|
||||||
scope.SetTag("Webrequest", webrequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(userLogin))
|
|
||||||
{
|
|
||||||
scope.SetTag("UserLogin", userLogin);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Debug(message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else logger.Debug(message);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogError(string message, string entityMessage = null, string webrequest = null, string userLogin = null)
|
|
||||||
{
|
|
||||||
//WriteLog(logger.Error, message, entityMessage, webrequest, userLogin);
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Entity", !String.IsNullOrEmpty(entityMessage) ? entityMessage : "");
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Webrequest", !String.IsNullOrEmpty(webrequest) ? webrequest : "");
|
|
||||||
|
|
||||||
if (AppLoggerConfig.NlogSentryConfig.NlogSentryIsEnable)
|
|
||||||
{
|
|
||||||
SentrySdk.WithScope(scope =>
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(entityMessage))
|
|
||||||
{
|
|
||||||
scope.SetTag("Entity", entityMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(webrequest))
|
|
||||||
{
|
|
||||||
scope.SetTag("Webrequest", webrequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(userLogin))
|
|
||||||
{
|
|
||||||
scope.SetTag("UserLogin", userLogin);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Error(message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else logger.Error(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogException(Exception exception, string entityMessage = null, string webrequest = null, string userLogin = null)
|
|
||||||
{
|
|
||||||
//WriteLog(logger.Error, exception, entityMessage, webrequest, userLogin);
|
|
||||||
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Entity", !String.IsNullOrEmpty(entityMessage) ? entityMessage : "");
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Webrequest", !String.IsNullOrEmpty(webrequest) ? webrequest : "");
|
|
||||||
|
|
||||||
if (AppLoggerConfig.NlogSentryConfig.NlogSentryIsEnable)
|
|
||||||
{
|
|
||||||
SentrySdk.WithScope(scope =>
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(entityMessage))
|
|
||||||
{
|
|
||||||
scope.SetTag("Entity", entityMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(webrequest))
|
|
||||||
{
|
|
||||||
scope.SetTag("Webrequest", webrequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(userLogin))
|
|
||||||
{
|
|
||||||
scope.SetTag("UserLogin", userLogin);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Error(exception);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else logger.Error(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogWarn(string message, string entityMessage = null, string webrequest = null, string userLogin = null)
|
|
||||||
{
|
|
||||||
//WriteLog(logger.Warn, message, entityMessage, webrequest, userLogin);
|
|
||||||
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Entity", !String.IsNullOrEmpty(entityMessage) ? entityMessage : "");
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Webrequest", !String.IsNullOrEmpty(webrequest) ? webrequest : "");
|
|
||||||
|
|
||||||
if (AppLoggerConfig.NlogSentryConfig.NlogSentryIsEnable)
|
|
||||||
{
|
|
||||||
SentrySdk.WithScope(scope =>
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(entityMessage))
|
|
||||||
{
|
|
||||||
scope.SetTag("Entity", entityMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(webrequest))
|
|
||||||
{
|
|
||||||
scope.SetTag("Webrequest", webrequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(userLogin))
|
|
||||||
{
|
|
||||||
scope.SetTag("UserLogin", userLogin);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Warn(message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else logger.Warn(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogInfo(string message, string entityMessage = null, string webrequest = null, string userLogin = null)
|
|
||||||
{
|
|
||||||
//WriteLog(logger.Info, message, entityMessage, webrequest, userLogin);
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Entity", !String.IsNullOrEmpty(entityMessage) ? entityMessage : "");
|
|
||||||
MappedDiagnosticsLogicalContext.Set("Webrequest", !String.IsNullOrEmpty(webrequest) ? webrequest : "");
|
|
||||||
|
|
||||||
if (AppLoggerConfig.NlogSentryConfig.NlogSentryIsEnable)
|
|
||||||
{
|
|
||||||
SentrySdk.WithScope(scope =>
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(entityMessage))
|
|
||||||
{
|
|
||||||
scope.SetTag("Entity", entityMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(webrequest))
|
|
||||||
{
|
|
||||||
scope.SetTag("Webrequest", webrequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(userLogin))
|
|
||||||
{
|
|
||||||
scope.SetTag("UserLogin", userLogin);
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Info(message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else logger.Info(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using NLog;
|
|
||||||
using Sentry;
|
|
||||||
|
|
||||||
namespace HRD.AppLogger
|
|
||||||
{
|
|
||||||
public class NlogSentryConfig
|
|
||||||
{
|
|
||||||
public bool AttachStacktrace { get; set; } = false;
|
|
||||||
public string Dsn { get; set; }
|
|
||||||
|
|
||||||
//
|
|
||||||
// Summary:
|
|
||||||
// Determines whether or not to include event-level data as data in breadcrumbs
|
|
||||||
// for future errors. Defaults to false.
|
|
||||||
public bool IncludeEventDataOnBreadcrumbs { get; set; } = false;
|
|
||||||
|
|
||||||
// Minimum log level to be included in the breadcrumb. Defaults to LogLevel.Info.
|
|
||||||
public LogLevel MinimumBreadcrumbLevel { get; set; } = LogLevel.Warn;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Summary:
|
|
||||||
// Minimum log level for events to trigger a send to Sentry. Defaults to LogLevel.Error.
|
|
||||||
public LogLevel MinimumEventLevel { get; set; } = LogLevel.Warn;
|
|
||||||
|
|
||||||
public bool NlogSentryIsEnable { get; set; }
|
|
||||||
public bool SendDefaultPii { get; set; } = false;
|
|
||||||
public User? SentryUser { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
namespace HRD.LDAPService.JWT
|
namespace HRD.LDAPService.JWT
|
||||||
{
|
{
|
||||||
|
//TODO: get this from config file (etc. appsettings.json)
|
||||||
public static class JwtGlobals
|
public static class JwtGlobals
|
||||||
{
|
{
|
||||||
public const string HttpContextItem_LdapUser = "ldapuser";
|
public const string HttpContextItem_LdapUser = "ldapuser";
|
||||||
@@ -15,5 +16,7 @@
|
|||||||
public const string ROLE_DEPARTMENTMASTER = "DepartmentMaster";
|
public const string ROLE_DEPARTMENTMASTER = "DepartmentMaster";
|
||||||
public const string ROLE_MASTER = "Master";
|
public const string ROLE_MASTER = "Master";
|
||||||
public const string ROLE_ADMIN = "Admin";
|
public const string ROLE_ADMIN = "Admin";
|
||||||
|
public const string ROLE_DD_ADMIN = "sDigital Data - IIM-Administratoren";
|
||||||
|
public const string ROLE_DD_USER = "sDigital Data - IIM-Benutzer";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,11 +145,13 @@ namespace HRD.LDAPService
|
|||||||
|
|
||||||
public static bool IsJwtGlobalsRole(string roleName)
|
public static bool IsJwtGlobalsRole(string roleName)
|
||||||
{
|
{
|
||||||
|
//TODO: Import them from db or config (etc. appsettigns.json)
|
||||||
return string.Equals(roleName, JwtGlobals.ROLE_USER, StringComparison.OrdinalIgnoreCase)
|
return string.Equals(roleName, JwtGlobals.ROLE_USER, StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(roleName, JwtGlobals.ROLE_DEPARTMENTUSER, StringComparison.OrdinalIgnoreCase)
|
|| string.Equals(roleName, JwtGlobals.ROLE_DEPARTMENTUSER, StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(roleName, JwtGlobals.ROLE_DEPARTMENTMASTER, StringComparison.OrdinalIgnoreCase)
|
|| string.Equals(roleName, JwtGlobals.ROLE_DEPARTMENTMASTER, StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(roleName, JwtGlobals.ROLE_MASTER, StringComparison.OrdinalIgnoreCase)
|
|| string.Equals(roleName, JwtGlobals.ROLE_MASTER, StringComparison.OrdinalIgnoreCase)
|
||||||
|| string.Equals(roleName, JwtGlobals.ROLE_ADMIN, StringComparison.OrdinalIgnoreCase);
|
|| string.Equals(roleName, JwtGlobals.ROLE_ADMIN, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| string.Equals(roleName, JwtGlobals.ROLE_DD_ADMIN, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddExtendedAttribute(string key, string value)
|
public void AddExtendedAttribute(string key, string value)
|
||||||
@@ -246,7 +248,7 @@ namespace HRD.LDAPService
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_LdapRoleListFilter.OnlyRoleList:
|
case EN_LdapRoleListFilter.OnlyRoleList:
|
||||||
if (IsJwtGlobalsRole(item.Role)) { resultList.Add(item.Role); }
|
if (IsJwtGlobalsRole(item.Role)){ resultList.Add(item.Role); }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EN_LdapRoleListFilter.OnlyWebAppRoleList:
|
case EN_LdapRoleListFilter.OnlyWebAppRoleList:
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netcoreapp7.0</TargetFramework>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
|
||||||
<PackageReference Include="xunit" Version="2.8.1" />
|
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\HRD.LDAPService\HRD.LDAPService.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using HRD.AppLogger;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -10,7 +10,7 @@ namespace HRD.WebApi
|
|||||||
{
|
{
|
||||||
public string WebRequestMethod { get; set; }
|
public string WebRequestMethod { get; set; }
|
||||||
public string WebRequestPath { get; set; }
|
public string WebRequestPath { get; set; }
|
||||||
public EN_LoggingLevel LoggingLevel { get; set; } = EN_LoggingLevel.Info;
|
public LogLevel LoggingLevel { get; set; } = LogLevel.Information;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: remove this. configure each with iconfiguretion using ioptions interface
|
//TODO: remove this. configure each with iconfiguretion using ioptions interface
|
||||||
@@ -18,13 +18,14 @@ namespace HRD.WebApi
|
|||||||
{
|
{
|
||||||
private static string _dalConnectionstring;
|
private static string _dalConnectionstring;
|
||||||
|
|
||||||
internal static EN_LoggingLevel GetMonitoringWebRequestLevel(string method, string path)
|
internal static LogLevel GetMonitoringWebRequestLevel(string method, string path)
|
||||||
{
|
{
|
||||||
var entity = NlogMonitoringWebRequest.FirstOrDefault(
|
var entity = NlogMonitoringWebRequest.FirstOrDefault(
|
||||||
x => x.WebRequestMethod.Equals(method, StringComparison.OrdinalIgnoreCase) &&
|
x => x.WebRequestMethod.Equals(method, StringComparison.OrdinalIgnoreCase) &&
|
||||||
(x.WebRequestPath == "*" || path.StartsWith(x.WebRequestPath, StringComparison.OrdinalIgnoreCase))
|
(x.WebRequestPath == "*" || path.StartsWith(x.WebRequestPath, StringComparison.OrdinalIgnoreCase))
|
||||||
);
|
);
|
||||||
if (entity == default) { return EN_LoggingLevel.Off; }
|
if (entity == default)
|
||||||
|
return LogLevel.None;
|
||||||
return entity.LoggingLevel;
|
return entity.LoggingLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,15 +70,6 @@ namespace HRD.WebApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLoggerConfig.Init(
|
|
||||||
WebApiConfig.AssemblyName, WebApiConfig.AssemblyVersion,
|
|
||||||
WebApiConfig.NlogDBLogLevel,
|
|
||||||
WebApiConfig.NlogFileLogLevel,
|
|
||||||
WebApiConfig.NlogLogDirectory);
|
|
||||||
AppLoggerConfig.NlogConnectionstring = NlogConnectionstring;
|
|
||||||
AppLoggerConfig.NlogSentryConfig.Dsn = WebApiConfig.NlogSentryDSN;
|
|
||||||
AppLoggerConfig.NlogSentryConfig.NlogSentryIsEnable = WebApiConfig.NlogSentryIsEnable;
|
|
||||||
|
|
||||||
//custom
|
//custom
|
||||||
var list = appSettings.GetSection("CustomConfig").GetChildren();
|
var list = appSettings.GetSection("CustomConfig").GetChildren();
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
@@ -86,14 +78,14 @@ namespace HRD.WebApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EN_LoggingLevel ToEnumLoggingLevel(string enumString)
|
public static LogLevel ToEnumLoggingLevel(string enumString)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(enumString))
|
if (string.IsNullOrEmpty(enumString))
|
||||||
{
|
{
|
||||||
return EN_LoggingLevel.Off;
|
return LogLevel.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (EN_LoggingLevel)Enum.Parse(typeof(EN_LoggingLevel), enumString);
|
return (LogLevel)Enum.Parse(typeof(LogLevel), enumString);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InitCustomSetting(Dictionary<string, string> customConfig)
|
internal static void InitCustomSetting(Dictionary<string, string> customConfig)
|
||||||
@@ -136,8 +128,8 @@ namespace HRD.WebApi
|
|||||||
public static bool NlogSentryIsEnable { get; set; } = true;
|
public static bool NlogSentryIsEnable { get; set; } = true;
|
||||||
|
|
||||||
public static string NlogConnectionstring { get; set; }
|
public static string NlogConnectionstring { get; set; }
|
||||||
public static EN_LoggingLevel NlogFileLogLevel { get; set; } = EN_LoggingLevel.Error;
|
public static LogLevel NlogFileLogLevel { get; set; } = LogLevel.Error;
|
||||||
public static EN_LoggingLevel NlogDBLogLevel { get; set; } = EN_LoggingLevel.Error;
|
public static LogLevel NlogDBLogLevel { get; set; } = LogLevel.Error;
|
||||||
|
|
||||||
public static DbContextOptions<DbContext> SQLOptions()
|
public static DbContextOptions<DbContext> SQLOptions()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using HRD.AppLogger;
|
using HRD.WebApi.DAL;
|
||||||
using HRD.WebApi.DAL;
|
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -15,12 +15,12 @@ namespace HRD.WebApi.Controllers
|
|||||||
public abstract class BaseController<TEntity> : Microsoft.AspNetCore.Mvc.Controller where TEntity : BaseEntity, new()
|
public abstract class BaseController<TEntity> : Microsoft.AspNetCore.Mvc.Controller where TEntity : BaseEntity, new()
|
||||||
{
|
{
|
||||||
private readonly IBaseRepository<TEntity> _entityRepository;
|
private readonly IBaseRepository<TEntity> _entityRepository;
|
||||||
private readonly ILoggerManager _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public BaseController(IBaseRepository<TEntity> baseRepository) : base()
|
public BaseController(IBaseRepository<TEntity> baseRepository, ILogger logger) : base()
|
||||||
{
|
{
|
||||||
_entityRepository = baseRepository;
|
_entityRepository = baseRepository;
|
||||||
_logger = new LoggerManager();
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IBaseRepository<TEntity> EntityRepository => _entityRepository;
|
protected IBaseRepository<TEntity> EntityRepository => _entityRepository;
|
||||||
@@ -178,19 +178,19 @@ namespace HRD.WebApi.Controllers
|
|||||||
[NonAction]
|
[NonAction]
|
||||||
public void WriteLogException(Exception exception, String entityMessage = null)
|
public void WriteLogException(Exception exception, String entityMessage = null)
|
||||||
{
|
{
|
||||||
_logger.LogException(exception, entityMessage);
|
_logger.LogError(exception, "{message}", entityMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public void WriteLogInfo(string message)
|
public void WriteLogInfo(string message)
|
||||||
{
|
{
|
||||||
_logger.LogInfo(message);
|
_logger.LogError("{message}", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public void WriteLogWarn(string message, String entityMessage = null)
|
public void WriteLogWarn(string message, String entityMessage = null)
|
||||||
{
|
{
|
||||||
_logger.LogWarn(message, entityMessage);
|
_logger.LogError(message, "{message}", entityMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using HRD.AppLogger;
|
using HRD.WebApi.DAL;
|
||||||
using HRD.WebApi.DAL;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace HRD.WebApi.Controllers
|
namespace HRD.WebApi.Controllers
|
||||||
@@ -10,43 +10,19 @@ namespace HRD.WebApi.Controllers
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public abstract class BaseMiniController : Microsoft.AspNetCore.Mvc.Controller
|
public abstract class BaseMiniController : Microsoft.AspNetCore.Mvc.Controller
|
||||||
{
|
{
|
||||||
private readonly ILoggerManager _logger;
|
protected readonly ILogger _logger;
|
||||||
public readonly WebApiBaseContext Context;
|
public readonly WebApiBaseContext Context;
|
||||||
|
|
||||||
public BaseMiniController(WebApiBaseContext webApiBaseContext)
|
public BaseMiniController(WebApiBaseContext webApiBaseContext, ILogger logger)
|
||||||
{
|
{
|
||||||
Context = webApiBaseContext;
|
Context = webApiBaseContext;
|
||||||
_logger = new LoggerManager();
|
_logger = logger;
|
||||||
}
|
|
||||||
|
|
||||||
[NonAction]
|
|
||||||
public void WriteLogDebug(string message, String entityMessage = null)
|
|
||||||
{
|
|
||||||
WriteLogDebug(message, entityMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NonAction]
|
|
||||||
public void WriteLogError(string message, String entityMessage = null)
|
|
||||||
{
|
|
||||||
_logger.LogError(message, entityMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public void WriteLogException(Exception exception, String entityMessage = null)
|
public void WriteLogException(Exception exception, String entityMessage = null)
|
||||||
{
|
{
|
||||||
_logger.LogException(exception, entityMessage);
|
_logger.LogError(exception, "{entityMessage}", entityMessage);
|
||||||
}
|
|
||||||
|
|
||||||
[NonAction]
|
|
||||||
public void WriteLogInfo(string message)
|
|
||||||
{
|
|
||||||
_logger.LogInfo(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NonAction]
|
|
||||||
public void WriteLogWarn(string message, String entityMessage = null)
|
|
||||||
{
|
|
||||||
_logger.LogWarn(message, entityMessage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using HRD.WebApi.DAL;
|
using HRD.WebApi.DAL;
|
||||||
using HRD.WebApi.Helpers;
|
using HRD.WebApi.Helpers;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace HRD.WebApi.Controllers
|
namespace HRD.WebApi.Controllers
|
||||||
@@ -10,7 +11,7 @@ namespace HRD.WebApi.Controllers
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public abstract class InfoBaseController : BaseMiniController
|
public abstract class InfoBaseController : BaseMiniController
|
||||||
{
|
{
|
||||||
public InfoBaseController(WebApiBaseContext webApiBaseContext) : base(webApiBaseContext)
|
public InfoBaseController(WebApiBaseContext webApiBaseContext, ILogger<InfoBaseController> logger) : base(webApiBaseContext, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ namespace HRD.WebApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
WriteLogException(ex);
|
_logger.LogError(ex, "{entityMessage}", ex.Message);
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
using HRD.AppLogger;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Diagnostics;
|
using Microsoft.AspNetCore.Diagnostics;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace HRD.WebApi.Helpers
|
namespace HRD.WebApi.Helpers
|
||||||
{
|
{
|
||||||
@@ -27,10 +28,11 @@ namespace HRD.WebApi.Helpers
|
|||||||
Detail = errorFeature.Error.Message
|
Detail = errorFeature.Error.Message
|
||||||
};
|
};
|
||||||
|
|
||||||
ILoggerManager logger = new LoggerManager();
|
var loggerFactory = app.ApplicationServices.GetRequiredService<ILoggerFactory>();
|
||||||
logger.LogException(errorFeature.Error, null, customError.URI);
|
ILogger logger = loggerFactory.CreateLogger("ExceptionExtension");
|
||||||
|
logger.LogError(errorFeature.Error, "An error occurred while processing the request. URI: {RequestUri}", customError.URI);
|
||||||
await context.Response.WriteAsync(customError.ToJsonString()).ConfigureAwait(false);
|
|
||||||
|
await context.Response.WriteAsync(JsonConvert.Serialize(customError)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using HRD.AppLogger;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
||||||
@@ -22,12 +21,7 @@ namespace HRD.WebApi.Helpers
|
|||||||
ConstructErrorMessages(context);
|
ConstructErrorMessages(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string URI { get; set; }
|
public string URI { get; init; }
|
||||||
|
|
||||||
public string ToJsonString()
|
|
||||||
{
|
|
||||||
return JsonConvert.Serialize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ConstructErrorMessages(ActionContext context)
|
private void ConstructErrorMessages(ActionContext context)
|
||||||
{
|
{
|
||||||
@@ -37,12 +31,10 @@ namespace HRD.WebApi.Helpers
|
|||||||
var errors = keyModelStatePair.Value.Errors;
|
var errors = keyModelStatePair.Value.Errors;
|
||||||
if (errors != null && errors.Count > 0)
|
if (errors != null && errors.Count > 0)
|
||||||
{
|
{
|
||||||
ILoggerManager logger = new LoggerManager();
|
|
||||||
if (errors.Count == 1)
|
if (errors.Count == 1)
|
||||||
{
|
{
|
||||||
var errorMessage = GetErrorMessage(errors[0]);
|
var errorMessage = GetErrorMessage(errors[0]);
|
||||||
base.Errors.Add(key, new[] { errorMessage });
|
base.Errors.Add(key, new[] { errorMessage });
|
||||||
logger.LogError(errorMessage, null, URI);
|
|
||||||
Detail = errorMessage;
|
Detail = errorMessage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -51,7 +43,6 @@ namespace HRD.WebApi.Helpers
|
|||||||
for (var i = 0; i < errors.Count; i++)
|
for (var i = 0; i < errors.Count; i++)
|
||||||
{
|
{
|
||||||
errorMessages[i] = GetErrorMessage(errors[i]);
|
errorMessages[i] = GetErrorMessage(errors[i]);
|
||||||
logger.LogError(errorMessages[i], null, URI);
|
|
||||||
if (i == 0) { Detail = errorMessages[i]; }
|
if (i == 0) { Detail = errorMessages[i]; }
|
||||||
}
|
}
|
||||||
base.Errors.Add(key, errorMessages);
|
base.Errors.Add(key, errorMessages);
|
||||||
@@ -60,10 +51,6 @@ namespace HRD.WebApi.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetErrorMessage(ModelError error)
|
private static string GetErrorMessage(ModelError error) => string.IsNullOrEmpty(error.ErrorMessage) ? "The input was not valid." : error.ErrorMessage;
|
||||||
{
|
|
||||||
return string.IsNullOrEmpty(error.ErrorMessage) ?
|
|
||||||
"The input was not valid." : error.ErrorMessage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -13,10 +14,12 @@ namespace HRD.WebApi.DAL.Middleware
|
|||||||
public class WebApiMiddleware
|
public class WebApiMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
private readonly RequestDelegate _next;
|
||||||
|
private readonly ILogger<WebApiMiddleware> _logger;
|
||||||
|
|
||||||
public WebApiMiddleware(RequestDelegate next)
|
public WebApiMiddleware(RequestDelegate next, ILogger<WebApiMiddleware> logger)
|
||||||
{
|
{
|
||||||
_next = next;
|
_next = next;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InvokeAsync(HttpContext httpContext)
|
public async Task InvokeAsync(HttpContext httpContext)
|
||||||
@@ -24,9 +27,9 @@ namespace HRD.WebApi.DAL.Middleware
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var loglevel = WebApiConfig.GetMonitoringWebRequestLevel(httpContext.Request.Method, httpContext.Request.Path.Value);
|
var loglevel = WebApiConfig.GetMonitoringWebRequestLevel(httpContext.Request.Method, httpContext.Request.Path.Value);
|
||||||
if (loglevel == AppLogger.EN_LoggingLevel.Info
|
if (loglevel == LogLevel.Information
|
||||||
|| loglevel == AppLogger.EN_LoggingLevel.Warn
|
|| loglevel == LogLevel.Warning
|
||||||
|| loglevel == AppLogger.EN_LoggingLevel.Error
|
|| loglevel == LogLevel.Error
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var requestReader = new StreamReader(httpContext.Request.Body);
|
var requestReader = new StreamReader(httpContext.Request.Body);
|
||||||
@@ -35,10 +38,10 @@ namespace HRD.WebApi.DAL.Middleware
|
|||||||
{
|
{
|
||||||
requestContent = $"{httpContext.Request.Method} {httpContext.Request.Path.Value}";
|
requestContent = $"{httpContext.Request.Method} {httpContext.Request.Path.Value}";
|
||||||
}
|
}
|
||||||
AppLogger.ILoggerManager logger = new AppLogger.LoggerManager();
|
|
||||||
if (loglevel == AppLogger.EN_LoggingLevel.Info) { logger.LogInfo(requestContent); }
|
if (loglevel == LogLevel.Information) { _logger.LogInformation(requestContent); }
|
||||||
if (loglevel == AppLogger.EN_LoggingLevel.Warn) { logger.LogWarn(requestContent); }
|
if (loglevel == LogLevel.Warning) { _logger.LogWarning(requestContent); }
|
||||||
if (loglevel == AppLogger.EN_LoggingLevel.Error) { logger.LogError(requestContent); }
|
if (loglevel == LogLevel.Error) { _logger.LogError(requestContent); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (System.Exception)
|
catch (System.Exception)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using HRD.AppLogger;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace HRD.WebApi.DAL.Middleware
|
namespace HRD.WebApi.DAL.Middleware
|
||||||
@@ -16,7 +16,7 @@ namespace HRD.WebApi.DAL.Middleware
|
|||||||
|
|
||||||
public string NlogConnectionstring { get; set; } = String.Empty;
|
public string NlogConnectionstring { get; set; } = String.Empty;
|
||||||
|
|
||||||
public EN_LoggingLevel NlogFileLogLevel { get; set; } = EN_LoggingLevel.Error;
|
public LogLevel NlogFileLogLevel { get; set; } = LogLevel.Error;
|
||||||
public EN_LoggingLevel NlogDBLogLevel { get; set; } = EN_LoggingLevel.Error;
|
public LogLevel NlogDBLogLevel { get; set; } = LogLevel.Error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using HRD.WebApi.DAL;
|
using HRD.WebApi.DAL;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace HRD.WebApi.Repositories
|
namespace HRD.WebApi.Repositories
|
||||||
{
|
{
|
||||||
public abstract class BaseRepository<T> : BaseRepositoryCore<T> where T : BaseEntity
|
public abstract class BaseRepository<T> : BaseRepositoryCore<T> where T : BaseEntity
|
||||||
{
|
{
|
||||||
public BaseRepository(WebApiBaseContext repositoryContext) : base(repositoryContext)
|
public BaseRepository(WebApiBaseContext repositoryContext, ILogger logger) : base(repositoryContext, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using HRD.AppLogger;
|
using HRD.WebApi.DAL;
|
||||||
using HRD.WebApi.DAL;
|
|
||||||
using HRD.WebApi.Helpers;
|
using HRD.WebApi.Helpers;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -12,19 +12,14 @@ namespace HRD.WebApi.Repositories
|
|||||||
{
|
{
|
||||||
public abstract class BaseRepositoryCore<T> : IBaseRepository<T> where T : BaseEntityCore
|
public abstract class BaseRepositoryCore<T> : IBaseRepository<T> where T : BaseEntityCore
|
||||||
{
|
{
|
||||||
private readonly ILoggerManager _logger;
|
protected readonly ILogger _logger;
|
||||||
|
|
||||||
protected DbContext RepositoryContext { get; private set; }
|
protected DbContext RepositoryContext { get; private set; }
|
||||||
|
|
||||||
protected BaseRepositoryCore(WebApiBaseContext repositoryContext)
|
protected BaseRepositoryCore(WebApiBaseContext repositoryContext, ILogger logger)
|
||||||
{
|
{
|
||||||
RepositoryContext = repositoryContext;
|
RepositoryContext = repositoryContext;
|
||||||
AppLoggerConfig.Init(
|
_logger = logger;
|
||||||
WebApiConfig.AssemblyName,
|
|
||||||
WebApiConfig.AssemblyVersion,
|
|
||||||
WebApiConfig.NlogDBLogLevel,
|
|
||||||
WebApiConfig.NlogFileLogLevel,
|
|
||||||
WebApiConfig.NlogLogDirectory);
|
|
||||||
_logger = new LoggerManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool Add(T entity, bool saveEntity = true)
|
public virtual bool Add(T entity, bool saveEntity = true)
|
||||||
@@ -592,28 +587,18 @@ namespace HRD.WebApi.Repositories
|
|||||||
_logger.LogDebug(message, entityMessage);
|
_logger.LogDebug(message, entityMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteLogError(string message, String entityMessage = null)
|
public void WriteLogError(string message, string entityMessage = null)
|
||||||
{
|
{
|
||||||
_logger.LogError(message, entityMessage);
|
_logger.LogError(message, "{entityMessage}", entityMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteLogException(Exception exception, String entityMessage = null)
|
public void WriteLogException(Exception exception, string entityMessage = null)
|
||||||
{
|
{
|
||||||
_logger.LogException(exception, entityMessage);
|
_logger.LogError(exception, "{entityMessage}", entityMessage);
|
||||||
if (WebApiConfig.RaiseRepositoryExceptions)
|
if (WebApiConfig.RaiseRepositoryExceptions)
|
||||||
{
|
{
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteLogInfo(string message)
|
|
||||||
{
|
|
||||||
_logger.LogInfo(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WriteLogWarn(string message, String entityMessage = null)
|
|
||||||
{
|
|
||||||
_logger.LogWarn(message, entityMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HRD.AppLogger", "HRD.AppLog
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HRD.LDAPService", "HRD.LDAPService\HRD.LDAPService.csproj", "{B90CF1F9-9AB5-4415-8211-2644D75AA276}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HRD.LDAPService", "HRD.LDAPService\HRD.LDAPService.csproj", "{B90CF1F9-9AB5-4415-8211-2644D75AA276}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HRD.LdapService.Test", "HRD.LdapService.Test\HRD.LdapService.Test.csproj", "{9E719C7C-B48C-4071-9412-886B41D7D442}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HRD.WebApi", "HRD.WebApi\HRD.WebApi.csproj", "{B886F61C-1555-477B-9804-319686FAF2C9}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HRD.WebApi", "HRD.WebApi\HRD.WebApi.csproj", "{B886F61C-1555-477B-9804-319686FAF2C9}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
@@ -42,10 +40,6 @@ Global
|
|||||||
{B90CF1F9-9AB5-4415-8211-2644D75AA276}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B90CF1F9-9AB5-4415-8211-2644D75AA276}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B90CF1F9-9AB5-4415-8211-2644D75AA276}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B90CF1F9-9AB5-4415-8211-2644D75AA276}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B90CF1F9-9AB5-4415-8211-2644D75AA276}.Release|Any CPU.Build.0 = Release|Any CPU
|
{B90CF1F9-9AB5-4415-8211-2644D75AA276}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{9E719C7C-B48C-4071-9412-886B41D7D442}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{9E719C7C-B48C-4071-9412-886B41D7D442}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{9E719C7C-B48C-4071-9412-886B41D7D442}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{9E719C7C-B48C-4071-9412-886B41D7D442}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{B886F61C-1555-477B-9804-319686FAF2C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{B886F61C-1555-477B-9804-319686FAF2C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{B886F61C-1555-477B-9804-319686FAF2C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B886F61C-1555-477B-9804-319686FAF2C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B886F61C-1555-477B-9804-319686FAF2C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B886F61C-1555-477B-9804-319686FAF2C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -55,8 +49,8 @@ Global
|
|||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {F02FC958-650A-495C-B4BA-13C2AFE9AB72}
|
|
||||||
SolutionGuid = {C7A45DA6-C1A5-4BE3-8A00-F3C3ABF566BA}
|
|
||||||
SolutionGuid = {3336A9F1-24F5-40E2-B3FB-42340B3E74A7}
|
SolutionGuid = {3336A9F1-24F5-40E2-B3FB-42340B3E74A7}
|
||||||
|
SolutionGuid = {C7A45DA6-C1A5-4BE3-8A00-F3C3ABF566BA}
|
||||||
|
SolutionGuid = {F02FC958-650A-495C-B4BA-13C2AFE9AB72}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class AdWebAppToWebAppRoleController : BaseController<AdWebAppToWebAppRole>
|
public class AdWebAppToWebAppRoleController : BaseController<AdWebAppToWebAppRole>
|
||||||
{
|
{
|
||||||
public AdWebAppToWebAppRoleController(IBaseRepository<AdWebAppToWebAppRole> repositoryBase) : base(repositoryBase)
|
public AdWebAppToWebAppRoleController(IBaseRepository<AdWebAppToWebAppRole> repositoryBase, ILogger<AdWebAppToWebAppRoleController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class CostCentreController : BaseController<CostCentre>
|
public class CostCentreController : BaseController<CostCentre>
|
||||||
{
|
{
|
||||||
public CostCentreController(IBaseRepository<CostCentre> repositoryBase) : base(repositoryBase)
|
public CostCentreController(IBaseRepository<CostCentre> repositoryBase, ILogger<CostCentreController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -15,7 +16,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class DepartmentController : BaseController<Department>
|
public class DepartmentController : BaseController<Department>
|
||||||
{
|
{
|
||||||
public DepartmentController(IBaseRepository<Department> repositoryBase) : base(repositoryBase)
|
public DepartmentController(IBaseRepository<Department> repositoryBase, ILogger<DepartmentController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class DepartmentToWebAppToEmployeeForWindreamController : BaseController<DepartmentToWebAppToEmployeeForWindream>
|
public class DepartmentToWebAppToEmployeeForWindreamController : BaseController<DepartmentToWebAppToEmployeeForWindream>
|
||||||
{
|
{
|
||||||
public DepartmentToWebAppToEmployeeForWindreamController(IBaseRepository<DepartmentToWebAppToEmployeeForWindream> repositoryBase) : base(repositoryBase)
|
public DepartmentToWebAppToEmployeeForWindreamController(IBaseRepository<DepartmentToWebAppToEmployeeForWindream> repositoryBase, ILogger<DepartmentToWebAppToEmployeeForWindreamController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class DocumentArtController : BaseController<DocumentArt>
|
public class DocumentArtController : BaseController<DocumentArt>
|
||||||
{
|
{
|
||||||
public DocumentArtController(IBaseRepository<DocumentArt> repositoryBase) : base(repositoryBase)
|
public DocumentArtController(IBaseRepository<DocumentArt> repositoryBase, ILogger<DocumentArtController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class DocumentArtToDepartmentController : BaseController<DocumentArtToDepartment>
|
public class DocumentArtToDepartmentController : BaseController<DocumentArtToDepartment>
|
||||||
{
|
{
|
||||||
public DocumentArtToDepartmentController(IBaseRepository<DocumentArtToDepartment> repositoryBase) : base(repositoryBase)
|
public DocumentArtToDepartmentController(IBaseRepository<DocumentArtToDepartment> repositoryBase, ILogger<DocumentArtToDepartmentController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class EmployeeAttributeController : BaseController<EmployeeAttribute>
|
public class EmployeeAttributeController : BaseController<EmployeeAttribute>
|
||||||
{
|
{
|
||||||
public EmployeeAttributeController(IBaseRepository<EmployeeAttribute> repositoryBase) : base(repositoryBase)
|
public EmployeeAttributeController(IBaseRepository<EmployeeAttribute> repositoryBase, ILogger<EmployeeAttributeController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ namespace StaffDBServer.Controllers
|
|||||||
{
|
{
|
||||||
public class EmployeeController : BaseController<Employee>
|
public class EmployeeController : BaseController<Employee>
|
||||||
{
|
{
|
||||||
public EmployeeController(IBaseRepository<Employee> repositoryBase) : base(repositoryBase)
|
public EmployeeController(IBaseRepository<Employee> repositoryBase, ILogger<EmployeeController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class EmployeeStatusController : BaseController<EmployeeStatus>
|
public class EmployeeStatusController : BaseController<EmployeeStatus>
|
||||||
{
|
{
|
||||||
public EmployeeStatusController(IBaseRepository<EmployeeStatus> repositoryBase) : base(repositoryBase)
|
public EmployeeStatusController(IBaseRepository<EmployeeStatus> repositoryBase, ILogger<EmployeeStatusController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class EmployeeToAttributeController : BaseController<EmployeeToAttribute>
|
public class EmployeeToAttributeController : BaseController<EmployeeToAttribute>
|
||||||
{
|
{
|
||||||
public EmployeeToAttributeController(IBaseRepository<EmployeeToAttribute> repositoryBase) : base(repositoryBase)
|
public EmployeeToAttributeController(IBaseRepository<EmployeeToAttribute> repositoryBase, ILogger<EmployeeToAttributeController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class EmployeeToDepartmentController : BaseController<EmployeeToDepartment>
|
public class EmployeeToDepartmentController : BaseController<EmployeeToDepartment>
|
||||||
{
|
{
|
||||||
public EmployeeToDepartmentController(IBaseRepository<EmployeeToDepartment> repositoryBase) : base(repositoryBase)
|
public EmployeeToDepartmentController(IBaseRepository<EmployeeToDepartment> repositoryBase, ILogger<EmployeeToDepartmentController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class EmployeeToWebAppController : BaseController<EmployeeToWebApp>
|
public class EmployeeToWebAppController : BaseController<EmployeeToWebApp>
|
||||||
{
|
{
|
||||||
public EmployeeToWebAppController(IBaseRepository<EmployeeToWebApp> repositoryBase) : base(repositoryBase)
|
public EmployeeToWebAppController(IBaseRepository<EmployeeToWebApp> repositoryBase, ILogger<EmployeeToWebAppController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class ProjectController : BaseController<Project>
|
public class ProjectController : BaseController<Project>
|
||||||
{
|
{
|
||||||
public ProjectController(IBaseRepository<Project> repositoryBase) : base(repositoryBase)
|
public ProjectController(IBaseRepository<Project> repositoryBase, ILogger<ProjectController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class RangController : BaseController<Rang>
|
public class RangController : BaseController<Rang>
|
||||||
{
|
{
|
||||||
public RangController(IBaseRepository<Rang> repositoryBase) : base(repositoryBase)
|
public RangController(IBaseRepository<Rang> repositoryBase, ILogger<RangController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class SubsidiaryController : BaseController<Subsidiary>
|
public class SubsidiaryController : BaseController<Subsidiary>
|
||||||
{
|
{
|
||||||
public SubsidiaryController(IBaseRepository<Subsidiary> repositoryBase) : base(repositoryBase)
|
public SubsidiaryController(IBaseRepository<Subsidiary> repositoryBase, ILogger<SubsidiaryController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WebAppAdditionalRoleController : BaseController<WebAppAdditionalRole>
|
public class WebAppAdditionalRoleController : BaseController<WebAppAdditionalRole>
|
||||||
{
|
{
|
||||||
public WebAppAdditionalRoleController(IBaseRepository<WebAppAdditionalRole> repositoryBase) : base(repositoryBase)
|
public WebAppAdditionalRoleController(IBaseRepository<WebAppAdditionalRole> repositoryBase, ILogger<WebAppAdditionalRoleController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WebAppController : BaseController<WebApp>
|
public class WebAppController : BaseController<WebApp>
|
||||||
{
|
{
|
||||||
public WebAppController(IBaseRepository<WebApp> repositoryBase) : base(repositoryBase)
|
public WebAppController(IBaseRepository<WebApp> repositoryBase, ILogger<WebAppController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using DAL.Models.Entities;
|
|||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.Controllers
|
namespace StaffDBServer.Controllers
|
||||||
{
|
{
|
||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WebAppRoleController : BaseController<WebAppRole>
|
public class WebAppRoleController : BaseController<WebAppRole>
|
||||||
{
|
{
|
||||||
public WebAppRoleController(IBaseRepository<WebAppRole> repositoryBase) : base(repositoryBase)
|
public WebAppRoleController(IBaseRepository<WebAppRole> repositoryBase, ILogger<WebAppRoleController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WebAppToDepartmentController : BaseController<WebAppToDepartment>
|
public class WebAppToDepartmentController : BaseController<WebAppToDepartment>
|
||||||
{
|
{
|
||||||
public WebAppToDepartmentController(IBaseRepository<WebAppToDepartment> repositoryBase) : base(repositoryBase)
|
public WebAppToDepartmentController(IBaseRepository<WebAppToDepartment> repositoryBase, ILogger<WebAppToDepartmentController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WebAppToWebAppAdditionalRoleController : BaseController<WebAppToWebAppAdditionalRole>
|
public class WebAppToWebAppAdditionalRoleController : BaseController<WebAppToWebAppAdditionalRole>
|
||||||
{
|
{
|
||||||
public WebAppToWebAppAdditionalRoleController(IBaseRepository<WebAppToWebAppAdditionalRole> repositoryBase) : base(repositoryBase)
|
public WebAppToWebAppAdditionalRoleController(IBaseRepository<WebAppToWebAppAdditionalRole> repositoryBase, ILogger<WebAppToWebAppAdditionalRoleController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WebAppToWebAppRoleController : BaseController<WebAppToWebAppRole>
|
public class WebAppToWebAppRoleController : BaseController<WebAppToWebAppRole>
|
||||||
{
|
{
|
||||||
public WebAppToWebAppRoleController(IBaseRepository<WebAppToWebAppRole> repositoryBase) : base(repositoryBase)
|
public WebAppToWebAppRoleController(IBaseRepository<WebAppToWebAppRole> repositoryBase, ILogger<WebAppToWebAppRoleController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WindreamColumnsToDepartmentController : BaseController<WindreamColumnsToDepartment>
|
public class WindreamColumnsToDepartmentController : BaseController<WindreamColumnsToDepartment>
|
||||||
{
|
{
|
||||||
public WindreamColumnsToDepartmentController(IBaseRepository<WindreamColumnsToDepartment> repositoryBase) : base(repositoryBase)
|
public WindreamColumnsToDepartmentController(IBaseRepository<WindreamColumnsToDepartment> repositoryBase, ILogger<WindreamColumnsToDepartmentController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WindreamIndexController : BaseController<WindreamIndex>
|
public class WindreamIndexController : BaseController<WindreamIndex>
|
||||||
{
|
{
|
||||||
public WindreamIndexController(IBaseRepository<WindreamIndex> repositoryBase) : base(repositoryBase)
|
public WindreamIndexController(IBaseRepository<WindreamIndex> repositoryBase, ILogger<WindreamIndexController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WindreamIndexToWindreamSearchToDepartmentController : BaseController<WindreamIndexToWindreamSearchToDepartment>
|
public class WindreamIndexToWindreamSearchToDepartmentController : BaseController<WindreamIndexToWindreamSearchToDepartment>
|
||||||
{
|
{
|
||||||
public WindreamIndexToWindreamSearchToDepartmentController(IBaseRepository<WindreamIndexToWindreamSearchToDepartment> repositoryBase) : base(repositoryBase)
|
public WindreamIndexToWindreamSearchToDepartmentController(IBaseRepository<WindreamIndexToWindreamSearchToDepartment> repositoryBase, ILogger<WindreamIndexToWindreamSearchToDepartmentController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WindreamInputFolderController : BaseController<WindreamInputFolder>
|
public class WindreamInputFolderController : BaseController<WindreamInputFolder>
|
||||||
{
|
{
|
||||||
public WindreamInputFolderController(IBaseRepository<WindreamInputFolder> repositoryBase) : base(repositoryBase)
|
public WindreamInputFolderController(IBaseRepository<WindreamInputFolder> repositoryBase, ILogger<WindreamInputFolderController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WindreamSearchController : BaseController<WindreamSearch>
|
public class WindreamSearchController : BaseController<WindreamSearch>
|
||||||
{
|
{
|
||||||
public WindreamSearchController(IBaseRepository<WindreamSearch> repositoryBase) : base(repositoryBase)
|
public WindreamSearchController(IBaseRepository<WindreamSearch> repositoryBase, ILogger<WindreamSearchController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WindreamSearchItemController : BaseController<WindreamSearchItem>
|
public class WindreamSearchItemController : BaseController<WindreamSearchItem>
|
||||||
{
|
{
|
||||||
public WindreamSearchItemController(IBaseRepository<WindreamSearchItem> repositoryBase) : base(repositoryBase)
|
public WindreamSearchItemController(IBaseRepository<WindreamSearchItem> repositoryBase, ILogger<WindreamSearchItemController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WindreamSearchItemToWindreamSearchToDepartmentController : BaseController<WindreamSearchItemToWindreamSearchToDepartment>
|
public class WindreamSearchItemToWindreamSearchToDepartmentController : BaseController<WindreamSearchItemToWindreamSearchToDepartment>
|
||||||
{
|
{
|
||||||
public WindreamSearchItemToWindreamSearchToDepartmentController(IBaseRepository<WindreamSearchItemToWindreamSearchToDepartment> repositoryBase) : base(repositoryBase)
|
public WindreamSearchItemToWindreamSearchToDepartmentController(IBaseRepository<WindreamSearchItemToWindreamSearchToDepartment> repositoryBase, ILogger<WindreamSearchItemToWindreamSearchToDepartmentController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HRD.WebApi.Controllers;
|
|||||||
using HRD.WebApi.Repositories;
|
using HRD.WebApi.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -15,7 +16,7 @@ namespace StaffDBServer.Controllers
|
|||||||
[JWTAuthorize]
|
[JWTAuthorize]
|
||||||
public class WindreamSearchToDepartmentController : BaseController<WindreamSearchToDepartment>
|
public class WindreamSearchToDepartmentController : BaseController<WindreamSearchToDepartment>
|
||||||
{
|
{
|
||||||
public WindreamSearchToDepartmentController(IBaseRepository<WindreamSearchToDepartment> repositoryBase) : base(repositoryBase)
|
public WindreamSearchToDepartmentController(IBaseRepository<WindreamSearchToDepartment> repositoryBase, ILogger<WindreamSearchToDepartmentController> logger) : base(repositoryBase, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,14 @@ namespace StaffDBServer.Extends
|
|||||||
//Admin Role
|
//Admin Role
|
||||||
list.Add(new JwtRole(JwtGlobals.ROLE_ADMIN, "GG_WebApp" + ADGroupPrefix + "_StaffDB_Admin"));
|
list.Add(new JwtRole(JwtGlobals.ROLE_ADMIN, "GG_WebApp" + ADGroupPrefix + "_StaffDB_Admin"));
|
||||||
|
|
||||||
|
//TODO: get roles from db
|
||||||
//Core RoleList
|
//Core RoleList
|
||||||
list.Add(new JwtRole(JwtGlobals.ROLE_USER, "GG_WebApp" + ADGroupPrefix + "_StaffDB_User")); //(RO) nur eigene
|
list.Add(new JwtRole(JwtGlobals.ROLE_USER, "GG_WebApp" + ADGroupPrefix + "_StaffDB_User")); //(RO) nur eigene
|
||||||
list.Add(new JwtRole(JwtGlobals.ROLE_MASTER, "GG_WebApp" + ADGroupPrefix + "_StaffDB_Master")); //RW ALLE Abteilungen
|
list.Add(new JwtRole(JwtGlobals.ROLE_MASTER, "GG_WebApp" + ADGroupPrefix + "_StaffDB_Master")); //RW ALLE Abteilungen
|
||||||
list.Add(new JwtRole(JwtGlobals.ROLE_DEPARTMENTUSER, "GG_WebApp" + ADGroupPrefix + "_StaffDB_DepartmentUser")); //(RW) auch andere aus eigener Abteilung
|
list.Add(new JwtRole(JwtGlobals.ROLE_DEPARTMENTUSER, "GG_WebApp" + ADGroupPrefix + "_StaffDB_DepartmentUser")); //(RW) auch andere aus eigener Abteilung
|
||||||
list.Add(new JwtRole(JwtGlobals.ROLE_DEPARTMENTMASTER, "GG_WebApp" + ADGroupPrefix + "_StaffDB_DepartmentMaster")); //(RW) auch andere aus eigener Abteilung
|
list.Add(new JwtRole(JwtGlobals.ROLE_DEPARTMENTMASTER, "GG_WebApp" + ADGroupPrefix + "_StaffDB_DepartmentMaster")); //(RW) auch andere aus eigener Abteilung
|
||||||
|
list.Add(new JwtRole(JwtGlobals.ROLE_DD_ADMIN, JwtGlobals.ROLE_DD_ADMIN)); //(RW) auch andere aus eigener Abteilung
|
||||||
|
list.Add(new JwtRole(JwtGlobals.ROLE_DD_USER, JwtGlobals.ROLE_DD_USER));
|
||||||
|
|
||||||
JwtMiddlewareOptions options = new JwtMiddlewareOptions()
|
JwtMiddlewareOptions options = new JwtMiddlewareOptions()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using DAL;
|
using DAL;
|
||||||
using HRD.AppLogger;
|
|
||||||
using HRD.WebApi;
|
using HRD.WebApi;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
@@ -23,17 +22,10 @@ using NSwag;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using NLog;
|
||||||
|
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) =>
|
var logger = NLog.LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
||||||
{
|
|
||||||
ILoggerManager logger = new LoggerManager();
|
|
||||||
logger.LogException((Exception)unhandledExceptionEventArgs.ExceptionObject, "Application closed due to exception.");
|
|
||||||
NLog.LogManager.Flush();
|
|
||||||
};
|
|
||||||
|
|
||||||
ILoggerManager logger = new LoggerManager();
|
|
||||||
logger.LogWarn($"[Start WebApi Server] BaseDirectory: {AppDomain.CurrentDomain.BaseDirectory}; TargetFrameworkName: {AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName}");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
@@ -62,9 +54,7 @@ try
|
|||||||
builder.Services.ConfigureJWT(StaffDBServer.Extends.JwtMiddlewareOptionsHelper.GetJwtMiddlewareOptions()); ;
|
builder.Services.ConfigureJWT(StaffDBServer.Extends.JwtMiddlewareOptionsHelper.GetJwtMiddlewareOptions()); ;
|
||||||
|
|
||||||
builder.Services.ConfigureDAL(WebApiMiddlewareOptionsHelper.GetWebApiMiddlewareOptions());
|
builder.Services.ConfigureDAL(WebApiMiddlewareOptionsHelper.GetWebApiMiddlewareOptions());
|
||||||
|
|
||||||
builder.Services.AddSingleton<ILoggerManager, LoggerManager>();
|
|
||||||
|
|
||||||
//SWAGGER
|
//SWAGGER
|
||||||
builder.Services.AddSwaggerDocument(config =>
|
builder.Services.AddSwaggerDocument(config =>
|
||||||
{
|
{
|
||||||
@@ -107,6 +97,8 @@ try
|
|||||||
|
|
||||||
var cnnStr = WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer);
|
var cnnStr = WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer);
|
||||||
|
|
||||||
|
builder.Services.Configure<WebApiContextOptions>(builder.Configuration.GetSection("WebApiContextOptions"));
|
||||||
|
|
||||||
builder.Services.AddDbContext<WebApiContext>(options =>
|
builder.Services.AddDbContext<WebApiContext>(options =>
|
||||||
{
|
{
|
||||||
const int dbTimeoutInMin = 5;
|
const int dbTimeoutInMin = 5;
|
||||||
@@ -114,6 +106,7 @@ try
|
|||||||
opts => opts.CommandTimeout((int)TimeSpan.FromMinutes(dbTimeoutInMin).TotalSeconds));
|
opts => opts.CommandTimeout((int)TimeSpan.FromMinutes(dbTimeoutInMin).TotalSeconds));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add repositories in DAL
|
||||||
builder.Services.AddStaffDBRepositories();
|
builder.Services.AddStaffDBRepositories();
|
||||||
builder.Services.AddScoped<WebAppUserHelper>();
|
builder.Services.AddScoped<WebAppUserHelper>();
|
||||||
builder.Services.AddJwtManagerWithLdap(configuration.GetSection("LdapOptions"));
|
builder.Services.AddJwtManagerWithLdap(configuration.GetSection("LdapOptions"));
|
||||||
@@ -162,7 +155,7 @@ try
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.LogException(ex, "Stopped program because of exception");
|
logger.Log(NLog.LogLevel.Error, ex, $"Stopped program because of exception\n{ex.Message}");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using DAL;
|
using DAL;
|
||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace StaffDBServer.SharedExtensions
|
namespace StaffDBServer.SharedExtensions
|
||||||
{
|
{
|
||||||
@@ -9,7 +10,7 @@ namespace StaffDBServer.SharedExtensions
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class InfoController : InfoBaseController
|
public class InfoController : InfoBaseController
|
||||||
{
|
{
|
||||||
public InfoController(WebApiContext context) : base(context)
|
public InfoController(WebApiContext context, ILogger<InfoController> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using HRD.LDAPService.JWT;
|
|||||||
using HRD.WebApi.Controllers;
|
using HRD.WebApi.Controllers;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -17,7 +18,7 @@ namespace StaffDBServer.SharedControllers
|
|||||||
private readonly WebAppUserRepository webAppUserRepository;
|
private readonly WebAppUserRepository webAppUserRepository;
|
||||||
private readonly WebAppUserHelper webAppUserHelper;
|
private readonly WebAppUserHelper webAppUserHelper;
|
||||||
|
|
||||||
public WebAppUserController(WebApiContext context, WebAppUserRepository webAppUserRepository, WebAppUserHelper webAppUserHelper) : base(context)
|
public WebAppUserController(WebApiContext context, WebAppUserRepository webAppUserRepository, WebAppUserHelper webAppUserHelper, ILogger<WebAppUserController> logger) : base(context, logger)
|
||||||
{
|
{
|
||||||
this.webAppUserRepository = webAppUserRepository;
|
this.webAppUserRepository = webAppUserRepository;
|
||||||
this.webAppUserHelper = webAppUserHelper;
|
this.webAppUserHelper = webAppUserHelper;
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Warning"
|
"Default": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"sqlConnection": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
"sqlConnection": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;",
|
||||||
|
"sqlConnection19": "Server=SDD-VMP04-SQL19\\DD_DEVELOP01;Database=DD_StaffDB;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||||
},
|
},
|
||||||
"AppConfig": {
|
"AppConfig": {
|
||||||
"LDAP_WebAppGroup_Is_Live": "false",
|
"LDAP_WebAppGroup_Is_Live": "false",
|
||||||
@@ -13,15 +14,57 @@
|
|||||||
"OfficeFileServerUrl": ""
|
"OfficeFileServerUrl": ""
|
||||||
},
|
},
|
||||||
|
|
||||||
"Nlog": {
|
// "Nlog": {
|
||||||
"NlogConnectionstring": "%sqlConnection%",
|
// "NlogConnectionstring": "%sqlConnection%",
|
||||||
"NlogDBLogLevel": "Warn",
|
// "NlogDBLogLevel": "Warn",
|
||||||
"NlogFileLogLevel": "Warn",
|
// "NlogFileLogLevel": "Warn",
|
||||||
"NlogLogDirectory": "c:\\temp\\_logs\\",
|
// "NlogLogDirectory": "c:\\temp\\_logs\\",
|
||||||
"NlogSentryDSN": "",
|
// "NlogSentryDSN": "",
|
||||||
"NlogSentryIsEnable": "false"
|
// "NlogSentryIsEnable": "false"
|
||||||
|
// },
|
||||||
|
"NLog": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Info"
|
||||||
|
},
|
||||||
|
"Targets": {
|
||||||
|
"console": {
|
||||||
|
"type": "Console",
|
||||||
|
"layout": "${longdate}|${level:uppercase=true}|${message}${onexception:${newline}${exception:format=ToString}}"
|
||||||
|
},
|
||||||
|
"infoFile": {
|
||||||
|
"type": "File",
|
||||||
|
"fileName": "E:\\LogFiles\\DigitalData\\info.log",
|
||||||
|
"layout": "${longdate}|${level:uppercase=true}|${message}${onexception:${newline}${exception:format=ToString}}"
|
||||||
|
},
|
||||||
|
"warnFile": {
|
||||||
|
"type": "File",
|
||||||
|
"fileName": "E:\\LogFiles\\DigitalData\\warn.log",
|
||||||
|
"layout": "${longdate}|${level:uppercase=true}|${message}${onexception:${newline}${exception:format=ToString}}"
|
||||||
|
},
|
||||||
|
"errorFile": {
|
||||||
|
"type": "File",
|
||||||
|
"fileName": "E:\\LogFiles\\DigitalData\\error.log",
|
||||||
|
"layout": "${longdate}|${level:uppercase=true}|${message}${onexception:${newline}${exception:format=ToString}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Rules": [
|
||||||
|
{
|
||||||
|
"logger": "*",
|
||||||
|
"minLevel": "Info",
|
||||||
|
"writeTo": "console,infoFile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"logger": "*",
|
||||||
|
"minLevel": "Warn",
|
||||||
|
"writeTo": "console,warnFile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"logger": "*",
|
||||||
|
"minLevel": "Error",
|
||||||
|
"writeTo": "console,errorFile"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
"CustomConfig": {
|
"CustomConfig": {
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -37,5 +80,11 @@
|
|||||||
"LDAP_EDM_Prefix": "GG_EDM",
|
"LDAP_EDM_Prefix": "GG_EDM",
|
||||||
"LDAP_WebAppp_Prefix": "GG_WebApp",
|
"LDAP_WebAppp_Prefix": "GG_WebApp",
|
||||||
"LDAP_Prefix_Test": "__Test"
|
"LDAP_Prefix_Test": "__Test"
|
||||||
|
},
|
||||||
|
// else if created with prepared crate table SQL,TableNamingRule is 'PREPARED-SQL' (e.g. dbo.Subsidiary, ecm.WindreamIndexToWindreamSearchToDepartment)
|
||||||
|
// else if you follow digital data SQL table naming rules, TableNamingRule is 'DIGITAL_DATA' (e.g. TBSTF_WEB_APP_ROLE)
|
||||||
|
// otherwise, TableNamingRule is 'PREPARED-SQL'
|
||||||
|
"WebApiContextOptions": {
|
||||||
|
"TableNamingRule": "DIGITAL_DATA"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
using HRD.LDAPService;
|
using HRD.LDAPService;
|
||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using System;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.Design;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace HRD.LdapService.Text
|
namespace XUnitWebApi.Test
|
||||||
{
|
{
|
||||||
public class LdapTest
|
public class LdapTest : TestBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
private static void InitJWTConfig(bool deaktivateLDAP = false)
|
private static void InitJWTConfig(bool deaktivateLDAP = false)
|
||||||
@@ -43,6 +41,7 @@ namespace HRD.LdapService.Text
|
|||||||
var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ2LmJvamFyc2tpIiwibmFtZWlkIjoiMCIsImVtYWlsIjoiVi5Cb2phcnNraUBoZW5zZWwtcmVjeWNsaW5nLmNvbSIsImRlcGFydG1lbnRpZCI6IjAiLCJleHRlbmRldGRlcGFydG1lbnRpZGxpc3QiOiIiLCJFeHRlbmRlZEF0dHJpYnV0ZXNfUmVnaW9uIjoiMTAsMjAiLCJFeHRlbmRlZEF0dHJpYnV0ZXNfQXR0cmlidXQjMSI6IkFCQ0BBQkMuREUsREVGQEFCQy5ERSxHRUhAQUJDLkRFIiwibmJmIjoxNjU4NzU4NDE0LCJleHAiOjE2NTkxMTg0MTQsImlhdCI6MTY1ODc1ODQxNH0.KUODwRBRn-xc3-0RaVKJ0uzwsXZ7RgORRAZUzTfxfNk";
|
var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ2LmJvamFyc2tpIiwibmFtZWlkIjoiMCIsImVtYWlsIjoiVi5Cb2phcnNraUBoZW5zZWwtcmVjeWNsaW5nLmNvbSIsImRlcGFydG1lbnRpZCI6IjAiLCJleHRlbmRldGRlcGFydG1lbnRpZGxpc3QiOiIiLCJFeHRlbmRlZEF0dHJpYnV0ZXNfUmVnaW9uIjoiMTAsMjAiLCJFeHRlbmRlZEF0dHJpYnV0ZXNfQXR0cmlidXQjMSI6IkFCQ0BBQkMuREUsREVGQEFCQy5ERSxHRUhAQUJDLkRFIiwibmJmIjoxNjU4NzU4NDE0LCJleHAiOjE2NTkxMTg0MTQsImlhdCI6MTY1ODc1ODQxNH0.KUODwRBRn-xc3-0RaVKJ0uzwsXZ7RgORRAZUzTfxfNk";
|
||||||
var loginName = "v.bojarski";
|
var loginName = "v.bojarski";
|
||||||
|
|
||||||
|
var JwtManager = Provider.GetRequiredService<JwtManager>();
|
||||||
LdapUser renewLdapUser = JwtManager.RenewLdapUserWithJwtToken(token);
|
LdapUser renewLdapUser = JwtManager.RenewLdapUserWithJwtToken(token);
|
||||||
|
|
||||||
Assert.Same(renewLdapUser.LoginName, loginName);
|
Assert.Same(renewLdapUser.LoginName, loginName);
|
||||||
@@ -73,6 +72,7 @@ namespace HRD.LdapService.Text
|
|||||||
|
|
||||||
|
|
||||||
ldapUser.ExtendedAttributesList = extendedAttributesList;
|
ldapUser.ExtendedAttributesList = extendedAttributesList;
|
||||||
|
var JwtManager = Provider.GetRequiredService<JwtManager>();
|
||||||
var isOk = JwtManager.GenerateLdapUserWithJwtToken(ldapUser);
|
var isOk = JwtManager.GenerateLdapUserWithJwtToken(ldapUser);
|
||||||
LdapUser ldapUserWithJWT = new LdapUser(ldapUser.LoginName);
|
LdapUser ldapUserWithJWT = new LdapUser(ldapUser.LoginName);
|
||||||
ldapUserWithJWT.Token = ldapUser.Token;
|
ldapUserWithJWT.Token = ldapUser.Token;
|
||||||
@@ -80,7 +80,8 @@ namespace HRD.LdapService.Text
|
|||||||
extendedAttributesList = new List<KeyValuePair<string, string>>();
|
extendedAttributesList = new List<KeyValuePair<string, string>>();
|
||||||
extendedAttributesList.Add(new KeyValuePair<string, string>("Attribut#1", "ABC@ABC.DE,DEF@ABC.DE,GEH@ABC.DE"));
|
extendedAttributesList.Add(new KeyValuePair<string, string>("Attribut#1", "ABC@ABC.DE,DEF@ABC.DE,GEH@ABC.DE"));
|
||||||
ldapUser.ExtendedAttributesList = extendedAttributesList;
|
ldapUser.ExtendedAttributesList = extendedAttributesList;
|
||||||
var renewLdapUserWithJWT = LdapAuthenticationService.RenewIdentity( ldapUserWithJWT);
|
var LdapAuthenticationService = Provider.GetRequiredService<LdapAuthenticationService>();
|
||||||
|
var renewLdapUserWithJWT = LdapAuthenticationService.RenewIdentity(ldapUserWithJWT);
|
||||||
|
|
||||||
Assert.True(renewLdapUserWithJWT.IsValid());
|
Assert.True(renewLdapUserWithJWT.IsValid());
|
||||||
}
|
}
|
||||||
@@ -101,11 +102,13 @@ namespace HRD.LdapService.Text
|
|||||||
|
|
||||||
ldapUser.AddExtendedAttribute("Attribut#1", "ABC@ABC.DE,DEF@ABC.DE,GEH@ABC.DE");
|
ldapUser.AddExtendedAttribute("Attribut#1", "ABC@ABC.DE,DEF@ABC.DE,GEH@ABC.DE");
|
||||||
ldapUser.AddExtendedAttribute("VendorId", "100210");
|
ldapUser.AddExtendedAttribute("VendorId", "100210");
|
||||||
|
var JwtManager = Provider.GetRequiredService<JwtManager>();
|
||||||
var isOk = JwtManager.GenerateLdapUserWithJwtToken(ldapUser);
|
var isOk = JwtManager.GenerateLdapUserWithJwtToken(ldapUser);
|
||||||
LdapUser ldapUserWithJWT = new LdapUser(ldapUser.LoginName);
|
LdapUser ldapUserWithJWT = new LdapUser(ldapUser.LoginName);
|
||||||
ldapUserWithJWT.Token = ldapUser.Token;
|
ldapUserWithJWT.Token = ldapUser.Token;
|
||||||
ldapUserWithJWT.PasswordHash = ldapUser.PasswordHash;
|
ldapUserWithJWT.PasswordHash = ldapUser.PasswordHash;
|
||||||
|
|
||||||
|
var LdapAuthenticationService = Provider.GetRequiredService<LdapAuthenticationService>();
|
||||||
var renewLdapUserWithJWT = LdapAuthenticationService.RenewIdentity(ldapUserWithJWT);
|
var renewLdapUserWithJWT = LdapAuthenticationService.RenewIdentity(ldapUserWithJWT);
|
||||||
|
|
||||||
LdapUser ldapUser2 = new LdapUser(LoginName);
|
LdapUser ldapUser2 = new LdapUser(LoginName);
|
||||||
@@ -115,7 +118,7 @@ namespace HRD.LdapService.Text
|
|||||||
|
|
||||||
Assert.Equal(ldapUser.PasswordHashShort, ldapUserWithJWT.PasswordHashShort);
|
Assert.Equal(ldapUser.PasswordHashShort, ldapUserWithJWT.PasswordHashShort);
|
||||||
Assert.True(renewLdapUserWithJWT.IsValid());
|
Assert.True(renewLdapUserWithJWT.IsValid());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -125,10 +128,8 @@ namespace HRD.LdapService.Text
|
|||||||
var loginName = "v.bojarski";
|
var loginName = "v.bojarski";
|
||||||
var groupName = "GG_WebApp__Test_Apps_User";
|
var groupName = "GG_WebApp__Test_Apps_User";
|
||||||
|
|
||||||
|
var LdapManager = Provider.GetRequiredService<LdapManager>();
|
||||||
Assert.True(LdapManager.AD_AddUserloginToGroup(loginName, groupName));
|
Assert.True(LdapManager.AD_AddUserloginToGroup(loginName, groupName));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
39
XUnitDAL.Test/TestBuilder.cs
Normal file
39
XUnitDAL.Test/TestBuilder.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using DAL;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using StaffDBServer.Controllers;
|
||||||
|
using StaffDBServer.SharedControllers;
|
||||||
|
|
||||||
|
namespace XUnitWebApi.Test
|
||||||
|
{
|
||||||
|
public class TestBuilder
|
||||||
|
{
|
||||||
|
private readonly ServiceCollection _services = new();
|
||||||
|
|
||||||
|
public ServiceCollection Services => !_lazyProvider.IsValueCreated
|
||||||
|
? _services
|
||||||
|
: throw new InvalidOperationException("Service provider has already been created.");
|
||||||
|
|
||||||
|
private readonly Lazy<IServiceProvider> _lazyProvider;
|
||||||
|
|
||||||
|
public IServiceProvider Provider => _lazyProvider.Value;
|
||||||
|
|
||||||
|
public TestBuilder()
|
||||||
|
{
|
||||||
|
Services.AddStaffDBRepositories();
|
||||||
|
Services.AddScoped<WebAppUserHelper>();
|
||||||
|
Services.AddDbContext<WebApiContext>(options =>
|
||||||
|
{
|
||||||
|
const int dbTimeoutInMin = 5;
|
||||||
|
options.UseSqlServer(
|
||||||
|
"Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;",
|
||||||
|
opts => opts.CommandTimeout((int)TimeSpan.FromMinutes(dbTimeoutInMin).TotalSeconds));
|
||||||
|
});
|
||||||
|
Services.AddSingleton<SubsidiaryController>();
|
||||||
|
|
||||||
|
_lazyProvider = new(Services.BuildServiceProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ForceBuild() => _ = Provider;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
using DAL.Repositories;
|
using DAL.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using NLog.Filters;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using StaffDBServer.Controllers;
|
using StaffDBServer.Controllers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using XUnitWebApi.SharedConfig;
|
using XUnitWebApi.SharedConfig;
|
||||||
|
using XUnitWebApi.Test;
|
||||||
|
|
||||||
namespace XUnitWebApi.Controller
|
namespace XUnitWebApi.Controller
|
||||||
{
|
{
|
||||||
public class Test_Controller_Entity
|
public class Test_Controller_Entity : TestBuilder
|
||||||
{
|
{
|
||||||
//----Check_GetEntityController
|
//----Check_GetEntityController
|
||||||
|
|
||||||
@@ -19,8 +20,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
SubsidiaryRepository repository = new SubsidiaryRepository();
|
var controller = Provider.GetService<SubsidiaryController>();
|
||||||
SubsidiaryController controller = new SubsidiaryController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -43,8 +43,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 49;
|
int entityId = 49;
|
||||||
WindreamInputFolderRepository repository = new WindreamInputFolderRepository();
|
var controller = Provider.GetService<WindreamInputFolderController>();
|
||||||
WindreamInputFolderController controller = new WindreamInputFolderController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -67,8 +66,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WindreamSearchToDepartmentRepository repository = new WindreamSearchToDepartmentRepository();
|
var controller = Provider.GetService<WindreamSearchToDepartmentController>();
|
||||||
WindreamSearchToDepartmentController controller = new WindreamSearchToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -91,8 +89,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WindreamSearchItemToWindreamSearchToDepartmentRepository repository = new WindreamSearchItemToWindreamSearchToDepartmentRepository();
|
var controller = Provider.GetService<WindreamSearchItemToWindreamSearchToDepartmentController>();
|
||||||
WindreamSearchItemToWindreamSearchToDepartmentController controller = new WindreamSearchItemToWindreamSearchToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -115,8 +112,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WindreamSearchItemRepository repository = new WindreamSearchItemRepository();
|
var controller = Provider.GetService<WindreamSearchItemController>();
|
||||||
WindreamSearchItemController controller = new WindreamSearchItemController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -139,8 +135,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WindreamSearchRepository repository = new WindreamSearchRepository();
|
var controller = Provider.GetService<WindreamSearchController>();
|
||||||
WindreamSearchController controller = new WindreamSearchController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -163,8 +158,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WindreamIndexToWindreamSearchToDepartmentRepository repository = new WindreamIndexToWindreamSearchToDepartmentRepository();
|
var controller = Provider.GetService<WindreamIndexToWindreamSearchToDepartmentController>();
|
||||||
WindreamIndexToWindreamSearchToDepartmentController controller = new WindreamIndexToWindreamSearchToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -187,8 +181,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WindreamIndexRepository repository = new WindreamIndexRepository();
|
var controller = Provider.GetService<WindreamIndexController>();
|
||||||
WindreamIndexController controller = new WindreamIndexController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -211,8 +204,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WindreamColumnsToDepartmentRepository repository = new WindreamColumnsToDepartmentRepository();
|
var controller = Provider.GetService<WindreamColumnsToDepartmentController>();
|
||||||
WindreamColumnsToDepartmentController controller = new WindreamColumnsToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -235,8 +227,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 2;
|
int entityId = 2;
|
||||||
WebAppToWebAppRoleRepository repository = new WebAppToWebAppRoleRepository();
|
var controller = Provider.GetService<WebAppToWebAppRoleController>();
|
||||||
WebAppToWebAppRoleController controller = new WebAppToWebAppRoleController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -259,8 +250,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 70;
|
int entityId = 70;
|
||||||
WebAppToWebAppAdditionalRoleRepository repository = new WebAppToWebAppAdditionalRoleRepository();
|
var controller = Provider.GetService<WebAppToWebAppAdditionalRoleController>();
|
||||||
WebAppToWebAppAdditionalRoleController controller = new WebAppToWebAppAdditionalRoleController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -283,8 +273,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 100;
|
int entityId = 100;
|
||||||
WebAppToDepartmentRepository repository = new WebAppToDepartmentRepository();
|
var controller = Provider.GetService<WebAppToDepartmentController>();
|
||||||
WebAppToDepartmentController controller = new WebAppToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -307,8 +296,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WebAppAdditionalRoleRepository repository = new WebAppAdditionalRoleRepository();
|
var controller = Provider.GetService<WebAppAdditionalRoleController>();
|
||||||
WebAppAdditionalRoleController controller = new WebAppAdditionalRoleController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -331,8 +319,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 300;
|
int entityId = 300;
|
||||||
EmployeeToWebAppRepository repository = new EmployeeToWebAppRepository();
|
var controller = Provider.GetService<EmployeeToWebAppController>();
|
||||||
EmployeeToWebAppController controller = new EmployeeToWebAppController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -355,8 +342,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
EmployeeToDepartmentRepository repository = new EmployeeToDepartmentRepository();
|
var controller = Provider.GetService<EmployeeToDepartmentController>();
|
||||||
EmployeeToDepartmentController controller = new EmployeeToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -379,8 +365,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 100;
|
int entityId = 100;
|
||||||
EmployeeToAttributeRepository repository = new EmployeeToAttributeRepository();
|
var controller = Provider.GetService<EmployeeToAttributeController>();
|
||||||
EmployeeToAttributeController controller = new EmployeeToAttributeController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -403,8 +388,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
EmployeeRepository repository = new EmployeeRepository();
|
var controller = Provider.GetService<EmployeeController>();
|
||||||
EmployeeController controller = new EmployeeController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -427,8 +411,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
DocumentArtToDepartmentRepository repository = new DocumentArtToDepartmentRepository();
|
var controller = Provider.GetService<DocumentArtToDepartmentController>();
|
||||||
DocumentArtToDepartmentController controller = new DocumentArtToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -451,8 +434,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
DepartmentToWebAppToEmployeeForWindreamRepository repository = new DepartmentToWebAppToEmployeeForWindreamRepository();
|
var controller = Provider.GetService<DepartmentToWebAppToEmployeeForWindreamController>();
|
||||||
DepartmentToWebAppToEmployeeForWindreamController controller = new DepartmentToWebAppToEmployeeForWindreamController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -475,8 +457,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 10;
|
int entityId = 10;
|
||||||
WebAppRoleRepository repository = new WebAppRoleRepository();
|
var controller = Provider.GetService<WebAppRoleController>();
|
||||||
WebAppRoleController controller = new WebAppRoleController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -499,8 +480,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
WebAppRepository repository = new WebAppRepository();
|
var controller = Provider.GetService<WebAppController>();
|
||||||
WebAppController controller = new WebAppController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -523,8 +503,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
RangRepository repository = new RangRepository();
|
var controller = Provider.GetService<RangController>();
|
||||||
RangController controller = new RangController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -547,8 +526,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
ProjectRepository repository = new ProjectRepository();
|
var controller = Provider.GetService<ProjectController>();
|
||||||
ProjectController controller = new ProjectController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -571,8 +549,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
EmployeeStatusRepository repository = new EmployeeStatusRepository();
|
var controller = Provider.GetService<EmployeeStatusController>();
|
||||||
EmployeeStatusController controller = new EmployeeStatusController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -595,8 +572,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
EmployeeAttributeRepository repository = new EmployeeAttributeRepository();
|
var controller = Provider.GetService<EmployeeAttributeController>();
|
||||||
EmployeeAttributeController controller = new EmployeeAttributeController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -619,8 +595,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
DocumentArtRepository repository = new DocumentArtRepository();
|
var controller = Provider.GetService<DocumentArtController>();
|
||||||
DocumentArtController controller = new DocumentArtController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -643,8 +618,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
DepartmentRepository repository = new DepartmentRepository();
|
var controller = Provider.GetService<DepartmentController>();
|
||||||
DepartmentController controller = new DepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -667,8 +641,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 100;
|
int entityId = 100;
|
||||||
CostCentreRepository repository = new CostCentreRepository();
|
var controller = Provider.GetService<CostCentreController>();
|
||||||
CostCentreController controller = new CostCentreController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
@@ -692,7 +665,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 272;
|
int entityId = 272;
|
||||||
var repo = new EmployeeRepository();
|
var repo = Provider.GetService<EmployeeRepository>();
|
||||||
var entity= await repo.GetByIdAsync(entityId);
|
var entity= await repo.GetByIdAsync(entityId);
|
||||||
entity.PhoneNo = "1234";
|
entity.PhoneNo = "1234";
|
||||||
await repo.SaveChangesAsync();
|
await repo.SaveChangesAsync();
|
||||||
@@ -711,8 +684,7 @@ namespace XUnitWebApi.Controller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int entityId = 1;
|
int entityId = 1;
|
||||||
AdWebAppToWebAppRoleRepository repository = new AdWebAppToWebAppRoleRepository();
|
var controller = Provider.GetService<AdWebAppToWebAppRoleController>();
|
||||||
AdWebAppToWebAppRoleController controller = new AdWebAppToWebAppRoleController(repository);
|
|
||||||
dynamic result = await controller.GetEntityAsync(entityId);
|
dynamic result = await controller.GetEntityAsync(entityId);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
using DAL.Models.Filters;
|
using DAL.Models.Filters;
|
||||||
using DAL.Repositories;
|
using DAL.Repositories;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using StaffDBServer.Controllers;
|
using StaffDBServer.Controllers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using XUnitWebApi.SharedConfig;
|
using XUnitWebApi.SharedConfig;
|
||||||
|
using XUnitWebApi.Test;
|
||||||
|
|
||||||
namespace XUnitWebApi.Controller
|
namespace XUnitWebApi.Controller
|
||||||
{
|
{
|
||||||
public class Test_Controller_Filter
|
public class Test_Controller_Filter : TestBuilder
|
||||||
{
|
{
|
||||||
//----Check_GetEntityFilteredListController
|
//----Check_GetEntityFilteredListController
|
||||||
|
|
||||||
@@ -20,8 +22,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
WindreamInputFolderFilter filter = new WindreamInputFolderFilter();
|
WindreamInputFolderFilter filter = new WindreamInputFolderFilter();
|
||||||
filter.ClientId = 24110;
|
filter.ClientId = 24110;
|
||||||
WindreamInputFolderRepository repository = new WindreamInputFolderRepository();
|
var controller = Provider.GetRequiredService<WindreamInputFolderController>();
|
||||||
WindreamInputFolderController controller = new WindreamInputFolderController(repository);
|
|
||||||
dynamic result = await controller.GetWindreamInputFolderListAsync(filter);
|
dynamic result = await controller.GetWindreamInputFolderListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -46,8 +47,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
DepartmentFilter filter = new DepartmentFilter();
|
DepartmentFilter filter = new DepartmentFilter();
|
||||||
filter.DepartmentId = 16;
|
filter.DepartmentId = 16;
|
||||||
WindreamSearchToDepartmentRepository repository = new WindreamSearchToDepartmentRepository();
|
var controller = Provider.GetRequiredService<WindreamSearchToDepartmentController>();
|
||||||
WindreamSearchToDepartmentController controller = new WindreamSearchToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetWindreamSearchToDepartmentListAsync(filter);
|
dynamic result = await controller.GetWindreamSearchToDepartmentListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -72,8 +72,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
WindreamSearchToDepartmentFilter filter = new WindreamSearchToDepartmentFilter();
|
WindreamSearchToDepartmentFilter filter = new WindreamSearchToDepartmentFilter();
|
||||||
filter.DepartmentId = 16;
|
filter.DepartmentId = 16;
|
||||||
WindreamSearchItemToWindreamSearchToDepartmentRepository repository = new WindreamSearchItemToWindreamSearchToDepartmentRepository();
|
var controller = Provider.GetRequiredService<WindreamSearchItemToWindreamSearchToDepartmentController>();
|
||||||
WindreamSearchItemToWindreamSearchToDepartmentController controller = new WindreamSearchItemToWindreamSearchToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetWindreamSearchItemToWindreamSearchToDepartmentListAsync(filter);
|
dynamic result = await controller.GetWindreamSearchItemToWindreamSearchToDepartmentListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -98,8 +97,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
ClientIdFilter filter = new ClientIdFilter();
|
ClientIdFilter filter = new ClientIdFilter();
|
||||||
filter.ClientId = 24110;
|
filter.ClientId = 24110;
|
||||||
WindreamSearchItemRepository repository = new WindreamSearchItemRepository();
|
var controller = Provider.GetRequiredService<WindreamSearchItemController>();
|
||||||
WindreamSearchItemController controller = new WindreamSearchItemController(repository);
|
|
||||||
dynamic result = await controller.GetWindreamSearchItemListAsync(filter);
|
dynamic result = await controller.GetWindreamSearchItemListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -124,8 +122,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
ClientIdFilter filter = new ClientIdFilter();
|
ClientIdFilter filter = new ClientIdFilter();
|
||||||
filter.ClientId = 24110;
|
filter.ClientId = 24110;
|
||||||
WindreamSearchRepository repository = new WindreamSearchRepository();
|
var controller = Provider.GetRequiredService<WindreamSearchController>();
|
||||||
WindreamSearchController controller = new WindreamSearchController(repository);
|
|
||||||
dynamic result = await controller.GetWindreamSearchListAsync(filter);
|
dynamic result = await controller.GetWindreamSearchListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -150,8 +147,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
WindreamSearchToDepartmentFilter filter = new WindreamSearchToDepartmentFilter();
|
WindreamSearchToDepartmentFilter filter = new WindreamSearchToDepartmentFilter();
|
||||||
filter.DepartmentId = 16;
|
filter.DepartmentId = 16;
|
||||||
WindreamIndexToWindreamSearchToDepartmentRepository repository = new WindreamIndexToWindreamSearchToDepartmentRepository();
|
var controller = Provider.GetRequiredService<WindreamIndexToWindreamSearchToDepartmentController>();
|
||||||
WindreamIndexToWindreamSearchToDepartmentController controller = new WindreamIndexToWindreamSearchToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetWindreamIndexToWindreamSearchToDepartmentListAsync(filter);
|
dynamic result = await controller.GetWindreamIndexToWindreamSearchToDepartmentListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -176,8 +172,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
ClientIdFilter filter = new ClientIdFilter();
|
ClientIdFilter filter = new ClientIdFilter();
|
||||||
filter.ClientId = 24110;
|
filter.ClientId = 24110;
|
||||||
WindreamIndexRepository repository = new WindreamIndexRepository();
|
var controller = Provider.GetRequiredService<WindreamIndexController>();
|
||||||
WindreamIndexController controller = new WindreamIndexController(repository);
|
|
||||||
dynamic result = await controller.GetWindreamIndexListAsync(filter);
|
dynamic result = await controller.GetWindreamIndexListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -202,8 +197,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
DepartmentFilter filter = new DepartmentFilter();
|
DepartmentFilter filter = new DepartmentFilter();
|
||||||
filter.DepartmentId = 16;
|
filter.DepartmentId = 16;
|
||||||
WindreamColumnsToDepartmentRepository repository = new WindreamColumnsToDepartmentRepository();
|
var controller = Provider.GetRequiredService<WindreamColumnsToDepartmentController>();
|
||||||
WindreamColumnsToDepartmentController controller = new WindreamColumnsToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetWindreamColumnsToDepartmentListAsync(filter);
|
dynamic result = await controller.GetWindreamColumnsToDepartmentListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -228,8 +222,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
WebAppFilter filter = new WebAppFilter();
|
WebAppFilter filter = new WebAppFilter();
|
||||||
filter.WebAppId = 1;
|
filter.WebAppId = 1;
|
||||||
WebAppToWebAppRoleRepository repository = new WebAppToWebAppRoleRepository();
|
var controller = Provider.GetRequiredService<WebAppToWebAppRoleController>();
|
||||||
WebAppToWebAppRoleController controller = new WebAppToWebAppRoleController(repository);
|
|
||||||
dynamic result = await controller.GetWebAppToWebAppRoleListAsync(filter);
|
dynamic result = await controller.GetWebAppToWebAppRoleListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -254,8 +247,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeToWebAppFilter filter = new EmployeeToWebAppFilter();
|
EmployeeToWebAppFilter filter = new EmployeeToWebAppFilter();
|
||||||
filter.EmployeeToWebAppId = 73;
|
filter.EmployeeToWebAppId = 73;
|
||||||
WebAppToWebAppAdditionalRoleRepository repository = new WebAppToWebAppAdditionalRoleRepository();
|
var controller = Provider.GetRequiredService<WebAppToWebAppAdditionalRoleController>();
|
||||||
WebAppToWebAppAdditionalRoleController controller = new WebAppToWebAppAdditionalRoleController(repository);
|
|
||||||
dynamic result = await controller.GetWebAppToWebAppAdditionalRoleListAsync(filter);
|
dynamic result = await controller.GetWebAppToWebAppAdditionalRoleListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -280,8 +272,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeToWebAppFilter filter = new EmployeeToWebAppFilter();
|
EmployeeToWebAppFilter filter = new EmployeeToWebAppFilter();
|
||||||
filter.EmployeeToWebAppId = 39;
|
filter.EmployeeToWebAppId = 39;
|
||||||
WebAppToDepartmentRepository repository = new WebAppToDepartmentRepository();
|
var controller = Provider.GetRequiredService<WebAppToDepartmentController>();
|
||||||
WebAppToDepartmentController controller = new WebAppToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetWebAppToDepartmentListAsync(filter);
|
dynamic result = await controller.GetWebAppToDepartmentListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -306,8 +297,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
WebAppFilter filter = new WebAppFilter();
|
WebAppFilter filter = new WebAppFilter();
|
||||||
filter.WebAppId = 3;
|
filter.WebAppId = 3;
|
||||||
WebAppAdditionalRoleRepository repository = new WebAppAdditionalRoleRepository();
|
var controller = Provider.GetRequiredService<WebAppAdditionalRoleController>();
|
||||||
WebAppAdditionalRoleController controller = new WebAppAdditionalRoleController(repository);
|
|
||||||
dynamic result = await controller.GetWebAppAdditionalRoleListAsync(filter);
|
dynamic result = await controller.GetWebAppAdditionalRoleListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -332,8 +322,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeFilter filter = new EmployeeFilter();
|
EmployeeFilter filter = new EmployeeFilter();
|
||||||
filter.LoginName = "y.kochetenko";
|
filter.LoginName = "y.kochetenko";
|
||||||
EmployeeToWebAppRepository repository = new EmployeeToWebAppRepository();
|
var controller = Provider.GetRequiredService<EmployeeToWebAppController>();
|
||||||
EmployeeToWebAppController controller = new EmployeeToWebAppController(repository);
|
|
||||||
dynamic result = await controller.GetEmployeeToWebAppListAsync(filter);
|
dynamic result = await controller.GetEmployeeToWebAppListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -358,8 +347,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeFilter filter = new EmployeeFilter();
|
EmployeeFilter filter = new EmployeeFilter();
|
||||||
filter.EmployeeId = 29;
|
filter.EmployeeId = 29;
|
||||||
EmployeeToDepartmentRepository repository = new EmployeeToDepartmentRepository();
|
var controller = Provider.GetRequiredService<EmployeeToDepartmentController>();
|
||||||
EmployeeToDepartmentController controller = new EmployeeToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetEmployeeToDepartmentListAsync(filter);
|
dynamic result = await controller.GetEmployeeToDepartmentListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -384,8 +372,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeFilter filter = new EmployeeFilter();
|
EmployeeFilter filter = new EmployeeFilter();
|
||||||
filter.EmployeeId = 29;
|
filter.EmployeeId = 29;
|
||||||
EmployeeToAttributeRepository repository = new EmployeeToAttributeRepository();
|
var controller = Provider.GetRequiredService<EmployeeToAttributeController>();
|
||||||
EmployeeToAttributeController controller = new EmployeeToAttributeController(repository);
|
|
||||||
dynamic result = await controller.GetEmployeeToAttributeListAsync(filter);
|
dynamic result = await controller.GetEmployeeToAttributeListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -410,8 +397,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeFullFilter filter = new EmployeeFullFilter();
|
EmployeeFullFilter filter = new EmployeeFullFilter();
|
||||||
filter.ClientId = 24110;
|
filter.ClientId = 24110;
|
||||||
EmployeeRepository repository = new EmployeeRepository();
|
var controller = Provider.GetRequiredService<EmployeeController>();
|
||||||
EmployeeController controller = new EmployeeController(repository);
|
|
||||||
dynamic result = await controller.GetEmployeeListAsync(filter);
|
dynamic result = await controller.GetEmployeeListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -436,8 +422,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeFullFilter filter = new EmployeeFullFilter();
|
EmployeeFullFilter filter = new EmployeeFullFilter();
|
||||||
filter.IsActive = false;
|
filter.IsActive = false;
|
||||||
EmployeeRepository repository = new EmployeeRepository();
|
var controller = Provider.GetRequiredService<EmployeeController>();
|
||||||
EmployeeController controller = new EmployeeController(repository);
|
|
||||||
dynamic result = await controller.GetEmployeeListAsync(filter);
|
dynamic result = await controller.GetEmployeeListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -462,8 +447,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeFullFilter filter = new EmployeeFullFilter();
|
EmployeeFullFilter filter = new EmployeeFullFilter();
|
||||||
filter.Name = "";
|
filter.Name = "";
|
||||||
EmployeeRepository repository = new EmployeeRepository();
|
var controller = Provider.GetRequiredService<EmployeeController>();
|
||||||
EmployeeController controller = new EmployeeController(repository);
|
|
||||||
dynamic result = await controller.GetEmployeeListAsync(filter);
|
dynamic result = await controller.GetEmployeeListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -488,8 +472,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
DepartmentFilter filter = new DepartmentFilter();
|
DepartmentFilter filter = new DepartmentFilter();
|
||||||
filter.DepartmentId = 16;
|
filter.DepartmentId = 16;
|
||||||
DocumentArtToDepartmentRepository repository = new DocumentArtToDepartmentRepository();
|
var controller = Provider.GetRequiredService<DocumentArtToDepartmentController>();
|
||||||
DocumentArtToDepartmentController controller = new DocumentArtToDepartmentController(repository);
|
|
||||||
dynamic result = await controller.GetDocumentArtToDepartmentListAsync(filter);
|
dynamic result = await controller.GetDocumentArtToDepartmentListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
@@ -514,8 +497,7 @@ namespace XUnitWebApi.Controller
|
|||||||
{
|
{
|
||||||
EmployeeFilter filter = new EmployeeFilter();
|
EmployeeFilter filter = new EmployeeFilter();
|
||||||
filter.EmployeeId = 29;
|
filter.EmployeeId = 29;
|
||||||
DepartmentToWebAppToEmployeeForWindreamRepository repository = new DepartmentToWebAppToEmployeeForWindreamRepository();
|
var controller = Provider.GetRequiredService<DepartmentToWebAppToEmployeeForWindreamController>();
|
||||||
DepartmentToWebAppToEmployeeForWindreamController controller = new DepartmentToWebAppToEmployeeForWindreamController(repository);
|
|
||||||
dynamic result = await controller.GetDepartmentToWebAppToEmployeeForWindreamListAsync(filter);
|
dynamic result = await controller.GetDepartmentToWebAppToEmployeeForWindreamListAsync(filter);
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
using DAL;
|
using DAL;
|
||||||
using DAL._Shared.SharedRepositories;
|
using DAL._Shared.SharedRepositories;
|
||||||
using HRD.WebApi;
|
using HRD.WebApi;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using XUnitWebApi.SharedConfig;
|
using XUnitWebApi.SharedConfig;
|
||||||
using XUnitWebApi.SharedUtils;
|
using XUnitWebApi.SharedUtils;
|
||||||
|
using XUnitWebApi.Test;
|
||||||
|
|
||||||
namespace XUnitWebApi.SahredDAL
|
namespace XUnitWebApi.SahredDAL
|
||||||
{
|
{
|
||||||
public class Shared_Test_DAL
|
public class Shared_Test_DAL : TestBuilder
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async System.Threading.Tasks.Task Check_Repository_XXXAsync()
|
public async System.Threading.Tasks.Task Check_Repository_XXXAsync()
|
||||||
{
|
{
|
||||||
Shared_Test_Config.Init_Webapi_Context();
|
Shared_Test_Config.Init_Webapi_Context();
|
||||||
WebAppUserRepository webAppUserRepository = new WebAppUserRepository();
|
WebAppUserRepository webAppUserRepository = Provider.GetRequiredService<WebAppUserRepository>();
|
||||||
|
|
||||||
var res = await webAppUserRepository.TakeListAsync(2);
|
var res = await webAppUserRepository.TakeListAsync(2);
|
||||||
Assert.NotEmpty(res);
|
Assert.NotEmpty(res);
|
||||||
@@ -51,34 +53,34 @@ namespace XUnitWebApi.SahredDAL
|
|||||||
|
|
||||||
List<string> ExceptionList = new List<string>();
|
List<string> ExceptionList = new List<string>();
|
||||||
|
|
||||||
using WebApiContext ctx = new WebApiContext();
|
WebApiContext ctx = Provider.GetRequiredService<WebApiContext>();
|
||||||
{
|
|
||||||
Assert.True(ctx.Database.CanConnect());
|
Assert.True(ctx.Database.CanConnect());
|
||||||
var typeList = TestHelper.GetAllRepositories(namespaceName);
|
var typeList = TestHelper.GetAllRepositories(namespaceName);
|
||||||
|
|
||||||
foreach (var item in typeList)
|
foreach (var item in typeList)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
if (repositoryName == "" || item.Name.Contains(repositoryName))
|
||||||
{
|
{
|
||||||
if (repositoryName == "" || item.Name.Contains(repositoryName))
|
Type type = item as Type;
|
||||||
{
|
entityName = type.Name;
|
||||||
Type type = item as Type;
|
object instance = Activator.CreateInstance(type);
|
||||||
entityName = type.Name;
|
MethodInfo takeListMethod = type.GetMethod("TakeList");
|
||||||
object instance = Activator.CreateInstance(type);
|
dynamic list = takeListMethod.Invoke(instance, new object[] { count, true });
|
||||||
MethodInfo takeListMethod = type.GetMethod("TakeList");
|
System.Diagnostics.Debug.WriteLine(entityName);
|
||||||
dynamic list = takeListMethod.Invoke(instance, new object[] { count, true });
|
Assert.NotNull(list);
|
||||||
System.Diagnostics.Debug.WriteLine(entityName);
|
Assert.Equal(count, list.Count);
|
||||||
Assert.NotNull(list);
|
|
||||||
Assert.Equal(count, list.Count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.Message);
|
|
||||||
ExceptionList.Add($"Entity: {entityName} " + ex.Message + " " + ex.InnerException);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
ExceptionList.Add($"Entity: {entityName} " + ex.Message + " " + ex.InnerException);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var errList = "";
|
var errList = "";
|
||||||
foreach (var item in ExceptionList) errList += "\r\n -- " + item;
|
foreach (var item in ExceptionList) errList += "\r\n -- " + item;
|
||||||
if (ExceptionList.Count > 0) throw new Exception(errList);
|
if (ExceptionList.Count > 0) throw new Exception(errList);
|
||||||
|
|||||||
@@ -2,13 +2,15 @@
|
|||||||
using DAL._Shared.SharedRepositories;
|
using DAL._Shared.SharedRepositories;
|
||||||
using HRD.LDAPService;
|
using HRD.LDAPService;
|
||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using StaffDBServer.SharedControllers;
|
using StaffDBServer.SharedControllers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using XUnitWebApi.SharedConfig;
|
using XUnitWebApi.SharedConfig;
|
||||||
|
using XUnitWebApi.Test;
|
||||||
|
|
||||||
namespace XUnitWebApi.SharedLDAP
|
namespace XUnitWebApi.SharedLDAP
|
||||||
{
|
{
|
||||||
public class Shared_Test_LDAP
|
public class Shared_Test_LDAP : TestBuilder
|
||||||
{
|
{
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("user", "pwd")]
|
[InlineData("user", "pwd")]
|
||||||
@@ -26,15 +28,16 @@ namespace XUnitWebApi.SharedLDAP
|
|||||||
login);
|
login);
|
||||||
userFromClient.Password = passwort;
|
userFromClient.Password = passwort;
|
||||||
|
|
||||||
WebAppEmployeeInfoRepository webAppEmployeeInfoRepository = new WebAppEmployeeInfoRepository();
|
WebAppEmployeeInfoRepository webAppEmployeeInfoRepository = Provider.GetRequiredService<WebAppEmployeeInfoRepository>();
|
||||||
WebAppEmployeeInfo webAppEmployeeInfo = await webAppEmployeeInfoRepository.GetByAsync(x => x.LoginName == userFromClient.LoginName);
|
WebAppEmployeeInfo webAppEmployeeInfo = await webAppEmployeeInfoRepository.GetByAsync(x => x.LoginName == userFromClient.LoginName);
|
||||||
Assert.NotNull(webAppEmployeeInfo);
|
Assert.NotNull(webAppEmployeeInfo);
|
||||||
|
|
||||||
WebAppUserHelper webAppUserHelper = new WebAppUserHelper();
|
WebAppUserHelper webAppUserHelper = Provider.GetRequiredService<WebAppUserHelper>();
|
||||||
LdapUser ldapUserFromClient = new LdapUser(userFromClient.LoginName, webAppEmployeeInfo.EmployeeId, userFromClient.Password, webAppEmployeeInfo.DepartmentId, webAppEmployeeInfo.ExtendedDepartmentIdList);
|
LdapUser ldapUserFromClient = new LdapUser(userFromClient.LoginName, webAppEmployeeInfo.EmployeeId, userFromClient.Password, webAppEmployeeInfo.DepartmentId, webAppEmployeeInfo.ExtendedDepartmentIdList);
|
||||||
Assert.NotNull(ldapUserFromClient);
|
Assert.NotNull(ldapUserFromClient);
|
||||||
|
|
||||||
bool ldapUserOk = JwtManager.GenerateLdapUserWithJwtToken(ldapUserFromClient);
|
var jwtManager = Provider.GetRequiredService<JwtManager>();
|
||||||
|
bool ldapUserOk = jwtManager.GenerateLdapUserWithJwtToken(ldapUserFromClient);
|
||||||
Assert.True(ldapUserOk);
|
Assert.True(ldapUserOk);
|
||||||
|
|
||||||
WebAppUser newUser = await webAppUserHelper.CheckLoginWithNameAndPasswordAsync(userFromClient);
|
WebAppUser newUser = await webAppUserHelper.CheckLoginWithNameAndPasswordAsync(userFromClient);
|
||||||
@@ -55,7 +58,8 @@ namespace XUnitWebApi.SharedLDAP
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
LdapUser ldapUser = new LdapUser(login, 0, passwort);
|
LdapUser ldapUser = new LdapUser(login, 0, passwort);
|
||||||
var result = LdapAuthenticationService.CheckAndUpdateIdentityWithPassword(ldapUser);
|
var ldapAuthenticationService = Provider.GetRequiredService<LdapAuthenticationService>();
|
||||||
|
var result = ldapAuthenticationService.CheckAndUpdateIdentityWithPassword(ldapUser);
|
||||||
|
|
||||||
Assert.True(result);
|
Assert.True(result);
|
||||||
}
|
}
|
||||||
@@ -71,7 +75,8 @@ namespace XUnitWebApi.SharedLDAP
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = LdapAuthenticationService.CheckAndUpdateIdentityWithPassword(ldapUser);
|
var ldapAuthenticationService = Provider.GetRequiredService<LdapAuthenticationService>();
|
||||||
|
var result = ldapAuthenticationService.CheckAndUpdateIdentityWithPassword(ldapUser);
|
||||||
|
|
||||||
Assert.True(result);
|
Assert.True(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using HRD.AppLogger;
|
using HRD.LDAPService;
|
||||||
using HRD.LDAPService;
|
|
||||||
using HRD.LDAPService.JWT;
|
using HRD.LDAPService.JWT;
|
||||||
using HRD.WebApi;
|
using HRD.WebApi;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
@@ -23,8 +22,6 @@ namespace XUnitWebApi.SharedConfig
|
|||||||
WebApiConfig.AssemblyVersion = "xxx.xx";
|
WebApiConfig.AssemblyVersion = "xxx.xx";
|
||||||
//WebApiConfig.Connectionstring = Config_ConnectionString;
|
//WebApiConfig.Connectionstring = Config_ConnectionString;
|
||||||
//WebApiConfig.NlogConnectionstring = Config_ConnectionString;
|
//WebApiConfig.NlogConnectionstring = Config_ConnectionString;
|
||||||
WebApiConfig.NlogDBLogLevel = EN_LoggingLevel.Error;
|
|
||||||
WebApiConfig.NlogFileLogLevel = EN_LoggingLevel.Off;
|
|
||||||
WebApiConfig.RaiseRepositoryExceptions = false;
|
WebApiConfig.RaiseRepositoryExceptions = false;
|
||||||
|
|
||||||
//JWT#1
|
//JWT#1
|
||||||
|
|||||||
Reference in New Issue
Block a user