employees
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
namespace LaaProduction.Administration.Models
|
||||
{
|
||||
internal class Employee
|
||||
{
|
||||
public short EmployeeId { get; set; }
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
namespace LaaProduction.Administration.Repositories
|
||||
{
|
||||
using LaaProduction.Administration.Models;
|
||||
using LaaProduction.Administration.Repositories.Interfaces;
|
||||
|
||||
using LaaProductionSQL.Interfaces;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal class EmployeesRepository : IEmployeesRepository
|
||||
{
|
||||
private readonly ISQLConnection sqlConnection;
|
||||
|
||||
public EmployeesRepository(ISQLConnection sqlConnection)
|
||||
=> this.sqlConnection = sqlConnection;
|
||||
|
||||
public void CreateToken(short appId, short userId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [MitarbeiterTokens] (
|
||||
[AppId]
|
||||
, [UserId])
|
||||
VALUES (@{nameof(appId)}
|
||||
, @{nameof(userId)})")
|
||||
.SetParameter(nameof(appId), appId)
|
||||
.SetParameter(nameof(userId), userId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public short EmployeeId(string username, string password)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [Benutzername] = @{nameof(username)}
|
||||
AND [PasswordHash] = @{nameof(password)}")
|
||||
.SetParameter(nameof(username), username)
|
||||
.SetParameter(nameof(password), password)
|
||||
.FirstOrDefault(x => x.GetSmallint());
|
||||
|
||||
public Employee GetEmployee(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [M].[MitarbeiterNr]
|
||||
, [M].[Vorname] + ' ' + [M].[Name]
|
||||
, [M].[Benutzername]
|
||||
FROM [MitarbeiterTokens] AS [MT]
|
||||
JOIN [Mitarbeiter] AS [M]
|
||||
ON [M].[MitarbeiterNr] = [MT].[UserId]
|
||||
WHERE [MT].[Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.FirstOrDefault(x => new Employee
|
||||
{
|
||||
EmployeeId = x.GetSmallint(),
|
||||
DisplayName = x.GetString(),
|
||||
Username = x.GetString()
|
||||
});
|
||||
|
||||
public string GetToken(short appId, short userId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Token]
|
||||
FROM [MitarbeiterTokens]
|
||||
WHERE [AppId] = @{nameof(appId)}
|
||||
AND [UserId] = @{nameof(userId)}")
|
||||
.SetParameter(nameof(appId), appId)
|
||||
.SetParameter(nameof(userId), userId)
|
||||
.FirstOrDefault(x => x.GetString());
|
||||
|
||||
public IEnumerable<string> GetUserRoles(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MR].[Recht]
|
||||
FROM [MitarbeiterTokens] AS [MT]
|
||||
JOIN [MitarbeiterRechte] AS [MR]
|
||||
ON [MR].[MitarbeiterNr] = [MT].[UserId]
|
||||
WHERE [MT].[Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.ExecuteReader(x => x.GetString());
|
||||
|
||||
public bool TokenExists(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT COUNT(1)
|
||||
FROM [MitarbeiterTokens]
|
||||
WHERE [Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.FirstOrDefault(x => x.GetInt() > 0);
|
||||
}
|
||||
}
|
||||
+10
-9
@@ -1,14 +1,14 @@
|
||||
namespace LaaProduction.Administration
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Administration.Interfaces;
|
||||
using LaaProduction.Administration.Repositories.Interfaces;
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Principal;
|
||||
|
||||
public class AccountManagement : IAccountManagement
|
||||
public class AccountManager : IAccountManager
|
||||
{
|
||||
private static IIdentity anonymous
|
||||
=> new ClaimsIdentity(
|
||||
@@ -20,7 +20,7 @@
|
||||
private readonly IEmployeesRepository employeesRepository;
|
||||
private readonly ISoftwareRepository softwareRepository;
|
||||
|
||||
public AccountManagement()
|
||||
public AccountManager()
|
||||
{
|
||||
this.employeesRepository = ServiceProvider.GetService<IEmployeesRepository>();
|
||||
this.softwareRepository = ServiceProvider.GetService<ISoftwareRepository>();
|
||||
@@ -56,17 +56,18 @@
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim(nameof(employee.EmployeeId), employee.EmployeeId.ToString()),
|
||||
new Claim(nameof(employee.DisplayName), employee.DisplayName),
|
||||
new Claim(nameof(employee.FullName), employee.FullName),
|
||||
new Claim(nameof(employee.Username), employee.Username),
|
||||
new Claim(ClaimTypes.NameIdentifier, token),
|
||||
};
|
||||
|
||||
var userRoles = this.employeesRepository
|
||||
.GetUserRoles(token)
|
||||
.Intersect(typeof(UserRoles));
|
||||
.Intersect(typeof(UsersRoles));
|
||||
|
||||
foreach (var role in userRoles)
|
||||
{
|
||||
claims.Add(new Claim(nameof(UserRoles), role));
|
||||
claims.Add(new Claim(nameof(UsersRoles), role));
|
||||
}
|
||||
|
||||
var functions = this.softwareRepository
|
||||
@@ -82,7 +83,7 @@
|
||||
claims: claims,
|
||||
authenticationType: nameof(ClaimsIdentity),
|
||||
nameType: nameof(employee.EmployeeId),
|
||||
roleType: nameof(UserRoles));
|
||||
roleType: nameof(UsersRoles));
|
||||
}
|
||||
|
||||
return new ClaimsPrincipal(claimsIdentity);
|
||||
@@ -0,0 +1,46 @@
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class EmployeesManager : IEmployeesManager
|
||||
{
|
||||
private readonly IEmployeesRepository employeesRepository;
|
||||
private readonly IRolesRepository rolesRepository;
|
||||
|
||||
public EmployeesManager()
|
||||
{
|
||||
this.employeesRepository = ServiceProvider.GetService<IEmployeesRepository>();
|
||||
this.rolesRepository = ServiceProvider.GetService<IRolesRepository>();
|
||||
}
|
||||
|
||||
public object GetEmployee(short employeeId)
|
||||
=> this.employeesRepository.Find(employeeId)
|
||||
?? new object { };
|
||||
|
||||
public IEnumerable<object> GetEmployees()
|
||||
=> this.employeesRepository.All()
|
||||
?? Array.Empty<Employee>();
|
||||
|
||||
public IEnumerable<string> GetRoles()
|
||||
=> this.rolesRepository.All()
|
||||
?? Array.Empty<string>();
|
||||
|
||||
public IDictionary<string, bool> GetRoles(short employeeId)
|
||||
=> this.rolesRepository
|
||||
.All(employeeId)
|
||||
.ToDictionary(x => x.Key, x => x.Value)
|
||||
?? new Dictionary<string, bool>();
|
||||
|
||||
public void UpdateEmployeeRoles(short employeeId, IEnumerable<string> roles)
|
||||
{
|
||||
this.rolesRepository.Delete(employeeId);
|
||||
this.rolesRepository.Insert(employeeId, roles);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
namespace LaaProduction.Administration.Interfaces
|
||||
namespace LaaProduction.Personalization.Interfaces
|
||||
{
|
||||
using System.Security.Principal;
|
||||
|
||||
public interface IAccountManagement
|
||||
public interface IAccountManager
|
||||
{
|
||||
string GetAuthToken(string username, string password, string software);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace LaaProduction.Personalization.Interfaces
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IEmployeesManager
|
||||
{
|
||||
object GetEmployee(short employeeId);
|
||||
|
||||
IEnumerable<object> GetEmployees();
|
||||
|
||||
IDictionary<string, bool> GetRoles(short employeeId);
|
||||
|
||||
IEnumerable<string> GetRoles();
|
||||
|
||||
void UpdateEmployeeRoles(short employeeId, IEnumerable<string> roles);
|
||||
}
|
||||
}
|
||||
+10
-6
@@ -7,8 +7,8 @@
|
||||
<ProjectGuid>{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Administration</RootNamespace>
|
||||
<AssemblyName>Administration</AssemblyName>
|
||||
<RootNamespace>LaaProduction.Personalization</RootNamespace>
|
||||
<AssemblyName>LaaProduction.Personalization</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
@@ -60,18 +60,22 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AccountManagement.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="Interfaces\IAccountManagement.cs" />
|
||||
<Compile Include="AccountManager.cs" />
|
||||
<Compile Include="EmployeesManager.cs" />
|
||||
<Compile Include="Interfaces\IEmployeesManager.cs" />
|
||||
<Compile Include="PersonalizationExtensions.cs" />
|
||||
<Compile Include="Interfaces\IAccountManager.cs" />
|
||||
<Compile Include="Models\Employee.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Repositories\EmployeesRepository.cs" />
|
||||
<Compile Include="Repositories\Interfaces\IEmployeesRepository.cs" />
|
||||
<Compile Include="Repositories\Interfaces\IRolesRepository.cs" />
|
||||
<Compile Include="Repositories\Interfaces\ISoftwareRepository.cs" />
|
||||
<Compile Include="Repositories\RolesRepository.cs" />
|
||||
<Compile Include="Repositories\SoftwareRepository.cs" />
|
||||
<Compile Include="ServiceProvider.cs" />
|
||||
<Compile Include="SoftwareFunctions.cs" />
|
||||
<Compile Include="UserRoles.cs" />
|
||||
<Compile Include="UsersRoles.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace LaaProduction.Personalization.Models
|
||||
{
|
||||
internal class Employee
|
||||
{
|
||||
public short EmployeeId { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
public int RolesCount { get; set; }
|
||||
|
||||
public int FunctionsCount { get; set; }
|
||||
}
|
||||
}
|
||||
+6
-4
@@ -1,6 +1,6 @@
|
||||
namespace LaaProduction.Administration
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Administration.Interfaces;
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@@ -8,13 +8,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public static class Extensions
|
||||
public static class PersonalizationExtensions
|
||||
{
|
||||
public static IServiceCollection AddAdministration(this IServiceCollection services, string sqlConnectionString)
|
||||
{
|
||||
ServiceProvider.RegisterServices(sqlConnectionString);
|
||||
|
||||
return services.AddScoped<IAccountManagement, AccountManagement>();
|
||||
return services
|
||||
.AddScoped<IAccountManager, AccountManager>()
|
||||
.AddScoped<IEmployeesManager, EmployeesManager>();
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> Intersect(this IEnumerable<string> source, Type enumType)
|
||||
+2
@@ -3,6 +3,8 @@
|
||||
[Auftrag].[dbo].[Mitarbeiter]
|
||||
[Auftrag].[dbo].[MitarbeiterRechte]
|
||||
[Auftrag].[dbo].[MitarbeiterTokens]
|
||||
[Auftrag].[dbo].[MitarbeiterTokens]
|
||||
[Auftrag].[dbo].[SoftwareFunctions]
|
||||
[Auftrag].[dbo].[SoftwareFunctionsLog]
|
||||
[Auftrag].[dbo].[UsersFunctions]
|
||||
[Auftrag].[dbo].[VersionSoftwareAccess]
|
||||
@@ -0,0 +1,155 @@
|
||||
namespace LaaProduction.Personalization.Repositories
|
||||
{
|
||||
using LaaProduction.Personalization.Models;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using LaaProductionSQL.Interfaces;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal class EmployeesRepository : IEmployeesRepository
|
||||
{
|
||||
private readonly ISQLConnection sqlConnection;
|
||||
|
||||
public EmployeesRepository(ISQLConnection sqlConnection)
|
||||
=> this.sqlConnection = sqlConnection;
|
||||
|
||||
public IEnumerable<Employee> All()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
[E].[EmployeeId] AS [EmployeeId]
|
||||
, [E].[FullName] AS [FullName]
|
||||
, [E].[Username] AS [Username]
|
||||
, [E].[RolesCount] AS [RolesCount]
|
||||
, COUNT([UF].[SoftwareFunctionId])
|
||||
OVER (PARTITION BY [E].[EmployeeId]) AS [FunctionsCount]
|
||||
FROM (SELECT DISTINCT
|
||||
[M].[MitarbeiterNr] AS [EmployeeId]
|
||||
, [M].[Vorname] + ' ' + [M].[Name] AS [FullName]
|
||||
, [M].[Benutzername] AS [Username]
|
||||
, COUNT([MR].[Recht])
|
||||
OVER (PARTITION BY [M].[MitarbeiterNr]) AS [RolesCount]
|
||||
FROM [Mitarbeiter] AS [M]
|
||||
LEFT JOIN [MitarbeiterRechte] AS [MR]
|
||||
ON [MR].[MitarbeiterNr] = [M].[MitarbeiterNr])
|
||||
AS [E]
|
||||
LEFT JOIN [UsersFunctions] AS [UF]
|
||||
ON [UF].[UserId] = [E].[EmployeeId]
|
||||
ORDER BY [E].[FullName]")
|
||||
.ExecuteReader(x => new Employee
|
||||
{
|
||||
EmployeeId = x.GetSmallint(),
|
||||
FullName = x.GetString(),
|
||||
Username = x.GetString(),
|
||||
RolesCount = x.GetInt(),
|
||||
FunctionsCount = x.GetInt()
|
||||
});
|
||||
|
||||
public void CreateToken(short appId, short userId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [MitarbeiterTokens] (
|
||||
[AppId]
|
||||
, [UserId])
|
||||
VALUES (@{nameof(appId)}
|
||||
, @{nameof(userId)})")
|
||||
.SetParameter(nameof(appId), appId)
|
||||
.SetParameter(nameof(userId), userId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public short EmployeeId(string username, string password)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [Benutzername] = @{nameof(username)}
|
||||
AND [PasswordHash] = @{nameof(password)}")
|
||||
.SetParameter(nameof(username), username)
|
||||
.SetParameter(nameof(password), password)
|
||||
.FirstOrDefault(x => x.GetSmallint());
|
||||
|
||||
public Employee Find(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
[E].[EmployeeId] AS [EmployeeId]
|
||||
, [E].[FullName] AS [FullName]
|
||||
, [E].[Username] AS [Username]
|
||||
, [E].[RolesCount] AS [RolesCount]
|
||||
, COUNT([UF].[SoftwareFunctionId])
|
||||
OVER (PARTITION BY [E].[EmployeeId]) AS [FunctionsCount]
|
||||
FROM (SELECT DISTINCT
|
||||
[M].[MitarbeiterNr] AS [EmployeeId]
|
||||
, [M].[Vorname] + ' ' + [M].[Name] AS [FullName]
|
||||
, [M].[Benutzername] AS [Username]
|
||||
, COUNT([MR].[Recht])
|
||||
OVER (PARTITION BY [M].[MitarbeiterNr]) AS [RolesCount]
|
||||
FROM [Mitarbeiter] AS [M]
|
||||
LEFT JOIN [MitarbeiterRechte] AS [MR]
|
||||
ON [MR].[MitarbeiterNr] = [M].[MitarbeiterNr]
|
||||
WHERE [M].[MitarbeiterNr] = @{nameof(employeeId)})
|
||||
AS [E]
|
||||
LEFT JOIN [UsersFunctions] AS [UF]
|
||||
ON [UF].[UserId] = [E].[EmployeeId]
|
||||
ORDER BY [E].[FullName]")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.FirstOrDefault(x => new Employee
|
||||
{
|
||||
EmployeeId = x.GetSmallint(),
|
||||
FullName = x.GetString(),
|
||||
Username = x.GetString(),
|
||||
RolesCount = x.GetInt(),
|
||||
FunctionsCount = x.GetInt()
|
||||
});
|
||||
|
||||
public Employee GetEmployee(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [M].[MitarbeiterNr]
|
||||
, [M].[Vorname] + ' ' + [M].[Name]
|
||||
, [M].[Benutzername]
|
||||
FROM [MitarbeiterTokens] AS [MT]
|
||||
JOIN [Mitarbeiter] AS [M]
|
||||
ON [M].[MitarbeiterNr] = [MT].[UserId]
|
||||
WHERE [MT].[Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.FirstOrDefault(x => new Employee
|
||||
{
|
||||
EmployeeId = x.GetSmallint(),
|
||||
FullName = x.GetString(),
|
||||
Username = x.GetString()
|
||||
});
|
||||
|
||||
public string GetToken(short appId, short userId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [Token]
|
||||
FROM [MitarbeiterTokens]
|
||||
WHERE [AppId] = @{nameof(appId)}
|
||||
AND [UserId] = @{nameof(userId)}")
|
||||
.SetParameter(nameof(appId), appId)
|
||||
.SetParameter(nameof(userId), userId)
|
||||
.FirstOrDefault(x => x.GetString());
|
||||
|
||||
public IEnumerable<string> GetUserRoles(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MR].[Recht]
|
||||
FROM [MitarbeiterTokens] AS [MT]
|
||||
JOIN [MitarbeiterRechte] AS [MR]
|
||||
ON [MR].[MitarbeiterNr] = [MT].[UserId]
|
||||
WHERE [MT].[Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.ExecuteReader(x => x.GetString());
|
||||
|
||||
public bool TokenExists(string token)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT COUNT(1)
|
||||
FROM [MitarbeiterTokens]
|
||||
WHERE [Token] = @{nameof(token)}")
|
||||
.SetParameter(nameof(token), token)
|
||||
.FirstOrDefault(x => x.GetInt() > 0);
|
||||
}
|
||||
}
|
||||
+6
-2
@@ -1,15 +1,19 @@
|
||||
namespace LaaProduction.Administration.Repositories.Interfaces
|
||||
namespace LaaProduction.Personalization.Repositories.Interfaces
|
||||
{
|
||||
using LaaProduction.Administration.Models;
|
||||
using LaaProduction.Personalization.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal interface IEmployeesRepository
|
||||
{
|
||||
IEnumerable<Employee> All();
|
||||
|
||||
void CreateToken(short appId, short userId);
|
||||
|
||||
short EmployeeId(string username, string password);
|
||||
|
||||
Employee Find(short employeeId);
|
||||
|
||||
Employee GetEmployee(string token);
|
||||
|
||||
string GetToken(short appId, short userId);
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
namespace LaaProduction.Personalization.Repositories.Interfaces
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IRolesRepository
|
||||
{
|
||||
IEnumerable<string> All();
|
||||
|
||||
IEnumerable<KeyValuePair<string, bool>> All(short employeeId);
|
||||
|
||||
void Delete(short employeeId);
|
||||
|
||||
void Insert(short employeeId, IEnumerable<string> roles);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProduction.Administration.Repositories.Interfaces
|
||||
namespace LaaProduction.Personalization.Repositories.Interfaces
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
namespace LaaProduction.Personalization.Repositories
|
||||
{
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
using LaaProductionSQL.Interfaces;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
|
||||
public class RolesRepository : IRolesRepository
|
||||
{
|
||||
private readonly ISQLConnection sqlConnection;
|
||||
|
||||
public RolesRepository(ISQLConnection sqlConnection)
|
||||
=> this.sqlConnection = sqlConnection;
|
||||
|
||||
public IEnumerable<string> All()
|
||||
=> this.sqlConnection
|
||||
.CreateCommand(@"
|
||||
SELECT DISTINCT [Recht]
|
||||
FROM [MitarbeiterRechte]")
|
||||
.ExecuteReader(x => x.GetString());
|
||||
|
||||
public IEnumerable<KeyValuePair<string, bool>> All(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
[AllRoles].[Recht]
|
||||
, CAST(CASE WHEN [UsrRoles].[MitarbeiterNr] IS NULL THEN 0 ELSE 1 END AS BIT)
|
||||
FROM [MitarbeiterRechte] AS [AllRoles]
|
||||
LEFT JOIN [MitarbeiterRechte] AS [UsrRoles]
|
||||
ON [UsrRoles].[Recht] = [AllRoles].[Recht]
|
||||
AND [UsrRoles].[MitarbeiterNr] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteReader(x => new KeyValuePair<string, bool>(x.GetString(), x.GetBool()));
|
||||
|
||||
public void Delete(short employeeId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
DELETE FROM [MitarbeiterRechte]
|
||||
WHERE [MitarbeiterNr] = @{nameof(employeeId)}")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public void Insert(short employeeId, IEnumerable<string> roles)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
INSERT INTO [MitarbeiterRechte] ([MitarbeiterNr], [Recht])
|
||||
VALUES {string.Join(", ", roles.Select((x, i) => $"('{employeeId}', '{new SqlParameter(i.ToString(), x).SqlValue}')"))}")
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
namespace LaaProduction.Administration.Repositories
|
||||
namespace LaaProduction.Personalization.Repositories
|
||||
{
|
||||
using LaaProduction.Administration.Repositories.Interfaces;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using LaaProductionSQL.Interfaces;
|
||||
|
||||
+4
-3
@@ -1,7 +1,7 @@
|
||||
namespace LaaProduction.Administration
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
using LaaProduction.Administration.Repositories;
|
||||
using LaaProduction.Administration.Repositories.Interfaces;
|
||||
using LaaProduction.Personalization.Repositories;
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using LaaProductionSQL;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
serviceProvider = new ServiceCollection()
|
||||
.AddSingleton(_ => SQLConnection.CreateConnection(sqlConnectionString))
|
||||
.AddScoped<IEmployeesRepository, EmployeesRepository>()
|
||||
.AddScoped<IRolesRepository, RolesRepository>()
|
||||
.AddScoped<ISoftwareRepository, SoftwareRepository>()
|
||||
.BuildServiceProvider();
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProduction.Administration
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
public enum SoftwareFunctions
|
||||
{
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
namespace LaaProduction.Administration
|
||||
namespace LaaProduction.Personalization
|
||||
{
|
||||
public enum UserRoles
|
||||
public enum UsersRoles
|
||||
{
|
||||
AV_ABFRAGE_GEPRUEFTE,
|
||||
AV_ABFRAGEN6SIGMA,
|
||||
@@ -12,7 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documents", "Documents", "{
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProductionWeb", "LaaProductionWeb\LaaProductionWeb.csproj", "{D1AD077B-00E3-4663-AB9F-23FF65D98D2F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Administration", "LaaProduction.Administration\LaaProduction.Administration.csproj", "{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Personalization", "LaaProduction.Personalization\LaaProduction.Personalization.csproj", "{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -174,3 +174,24 @@ span.td-error {
|
||||
color: var(--bs-danger);
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.hover-dots {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.hover-dots:hover::before {
|
||||
content: "\F5D3";
|
||||
position: absolute;
|
||||
top: .25rem;
|
||||
right: 0;
|
||||
display: inline-block;
|
||||
font-family: bootstrap-icons !important;
|
||||
font-style: normal;
|
||||
font-weight: normal !important;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
vertical-align: -.125em;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
document
|
||||
.querySelectorAll('.nav-link')
|
||||
.forEach(x => {
|
||||
if (href.startsWith(x.href)) {
|
||||
if (href == x.href) {
|
||||
x.classList.add('active');
|
||||
} else {
|
||||
x.classList.remove('active');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using System.Web.Mvc;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public AllowedRolesAttribute(params string[] roles)
|
||||
=> this.Roles = string.Join(",", roles);
|
||||
|
||||
public AllowedRolesAttribute(params UserRoles[] roles)
|
||||
public AllowedRolesAttribute(params UsersRoles[] roles)
|
||||
=> this.Roles = string.Join(",", roles);
|
||||
|
||||
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
using LaaProduction.Administration.Interfaces;
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
|
||||
using IAuthorizationFilter = System.Web.Mvc.IAuthorizationFilter;
|
||||
using AuthorizationContext = System.Web.Mvc.AuthorizationContext;
|
||||
@@ -11,7 +11,7 @@
|
||||
{
|
||||
var httpContext = filterContext.HttpContext;
|
||||
var sessionUser = httpContext.GetSessionUser();
|
||||
var accountManagement = ServiceProvider.Current.GetService<IAccountManagement>();
|
||||
var accountManagement = ServiceProvider.GetService<IAccountManager>();
|
||||
httpContext.User = accountManagement.GetClaimsPrincipal(sessionUser);
|
||||
|
||||
if (httpContext.User.Identity.IsAuthenticated)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
|
||||
public class AuthorizeBearerAttribute : AuthorizeAttribute
|
||||
{
|
||||
private readonly IAccountManager accountManager;
|
||||
|
||||
public AuthorizeBearerAttribute()
|
||||
=> this.accountManager = ServiceProvider.GetService<IAccountManager>();
|
||||
|
||||
protected override bool IsAuthorized(HttpActionContext actionContext)
|
||||
{
|
||||
if (actionContext.Request.Headers.Authorization?.Scheme == "Bearer")
|
||||
{
|
||||
var bearer = actionContext.Request.Headers.Authorization.Parameter;
|
||||
var principal = this.accountManager.GetClaimsPrincipal(bearer);
|
||||
|
||||
return principal.Identity.IsAuthenticated;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
using LaaProductionHttp.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System;
|
||||
@@ -10,6 +11,7 @@
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
/// <summary>
|
||||
/// Static class with extension methods that run on controller contexts.
|
||||
@@ -18,7 +20,7 @@
|
||||
{
|
||||
const string ORDER_DATA = nameof(ORDER_DATA);
|
||||
const string URL_REFERER = nameof(URL_REFERER);
|
||||
const string SESSION_USER = nameof(SESSION_USER);
|
||||
const string LAA_USER = nameof(LAA_USER);
|
||||
|
||||
public static TDST Map<TSRC, TDST>(this TSRC model, Func<TSRC, TDST> mapper)
|
||||
where TDST : class
|
||||
@@ -35,12 +37,24 @@
|
||||
public static bool IsInRole<T>(this IPrincipal principal, T role)
|
||||
=> principal.IsInRole($"{role}");
|
||||
|
||||
public static string DisplayName(this IPrincipal principal)
|
||||
public static string GetNameIdentifier(this IPrincipal principal)
|
||||
{
|
||||
if (principal is ClaimsPrincipal claimsPrincipal)
|
||||
{
|
||||
return claimsPrincipal
|
||||
.FindAll(nameof(DisplayName))
|
||||
.FindFirst(ClaimTypes.NameIdentifier)
|
||||
?.Value;
|
||||
}
|
||||
|
||||
return default(string);
|
||||
}
|
||||
|
||||
public static string FullName(this IPrincipal principal)
|
||||
{
|
||||
if (principal is ClaimsPrincipal claimsPrincipal)
|
||||
{
|
||||
return claimsPrincipal
|
||||
.FindAll(nameof(FullName))
|
||||
.LastOrDefault()?.Value;
|
||||
}
|
||||
|
||||
@@ -64,7 +78,7 @@
|
||||
.Request
|
||||
.Cookies
|
||||
.Get(URL_REFERER)
|
||||
?.Value ?? null;
|
||||
?.Value ?? "~/";
|
||||
|
||||
public static void SetUrlReferer(this HttpContextBase httpContext)
|
||||
=> httpContext
|
||||
@@ -114,11 +128,11 @@
|
||||
public static string GetSessionUser(this HttpContextBase httpContext)
|
||||
{
|
||||
var requestCookies = httpContext.Request.Cookies;
|
||||
var sessionUser = requestCookies.Get(SESSION_USER);
|
||||
var sessionUser = requestCookies.Get(LAA_USER);
|
||||
|
||||
if (sessionUser is null)
|
||||
{
|
||||
sessionUser = new HttpCookie(SESSION_USER, string.Empty);
|
||||
sessionUser = new HttpCookie(LAA_USER, string.Empty);
|
||||
requestCookies.Add(sessionUser);
|
||||
}
|
||||
|
||||
@@ -132,7 +146,7 @@
|
||||
public static void SignIn(this HttpContextBase httpContext, string sessionUser)
|
||||
{
|
||||
httpContext.SignOut();
|
||||
httpContext.Response.AppendCookie(new HttpCookie(SESSION_USER, sessionUser)
|
||||
httpContext.Response.AppendCookie(new HttpCookie(LAA_USER, sessionUser)
|
||||
{
|
||||
Expires = DateTime.Now.AddSeconds(Appsettings.LoginTimeout)
|
||||
});
|
||||
@@ -140,8 +154,8 @@
|
||||
|
||||
public static void SignOut(this HttpContextBase httpContext)
|
||||
{
|
||||
httpContext.Request.Cookies.Remove(SESSION_USER);
|
||||
httpContext.Response.Cookies.Remove(SESSION_USER);
|
||||
httpContext.Request.Cookies.Remove(LAA_USER);
|
||||
httpContext.Response.Cookies.Remove(LAA_USER);
|
||||
}
|
||||
|
||||
public static string ComputeHash(this string value)
|
||||
@@ -157,5 +171,24 @@
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static void AddModelErrors(this ModelStateDictionary modelState, IHttpErrorResponse response)
|
||||
{
|
||||
if (response != null)
|
||||
{
|
||||
if (response.Errors != null)
|
||||
{
|
||||
foreach (var error in response.Errors)
|
||||
{
|
||||
modelState.AddModelError(error.Key, error.Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(response.Message))
|
||||
{
|
||||
modelState.AddModelError(nameof(response.Message), response.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
public class RouteParameterAttribute : ActionFilterAttribute
|
||||
{
|
||||
private readonly string parameterName;
|
||||
|
||||
public RouteParameterAttribute(string parameterName)
|
||||
=> this.parameterName = parameterName;
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
base.OnActionExecuting(filterContext);
|
||||
|
||||
if (filterContext.ActionParameters.ContainsKey(this.parameterName))
|
||||
{
|
||||
var parameter = filterContext
|
||||
.ActionDescriptor
|
||||
.GetParameters()
|
||||
.FirstOrDefault();
|
||||
var parameterValue = parameter.DefaultValue;
|
||||
|
||||
try
|
||||
{
|
||||
var routeValue = filterContext
|
||||
.RouteData
|
||||
.GetRequiredString("id");
|
||||
|
||||
parameterValue = JsonConvert.DeserializeObject(routeValue, parameter.ParameterType);
|
||||
}
|
||||
catch { }
|
||||
|
||||
filterContext.ActionParameters[this.parameterName] = parameterValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LaaProductionWeb
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using LaaProductionHttp;
|
||||
using LaaProductionSQL;
|
||||
@@ -16,7 +16,7 @@
|
||||
{
|
||||
private static IServiceProvider serviceProvider;
|
||||
|
||||
public T GetService<T>() where T : class
|
||||
public static T GetService<T>() where T : class
|
||||
=> serviceProvider.GetService<T>();
|
||||
|
||||
public static void RegisterServices()
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
{
|
||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||
|
||||
routes.MapMvcAttributeRoutes();
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Default",
|
||||
url: "{controller}/{action}/{id}",
|
||||
|
||||
@@ -9,10 +9,15 @@
|
||||
config.MapHttpAttributeRoutes();
|
||||
|
||||
config.Routes.MapHttpRoute(
|
||||
name: "AreasApi",
|
||||
routeTemplate: "api/{area}/{controller}/{id}",
|
||||
name: "PersonalizationApi",
|
||||
routeTemplate: "api/Personalization/{controller}/{id}",
|
||||
defaults: new { id = RouteParameter.Optional });
|
||||
|
||||
config.Routes.MapHttpRoute(
|
||||
name: "PersonalizationActionApi",
|
||||
routeTemplate: "api/Personalization/{controller}/{action}/{id}",
|
||||
defaults: new { action = "Get", id = RouteParameter.Optional });
|
||||
|
||||
config.Routes.MapHttpRoute(
|
||||
name: "DefaultApi",
|
||||
routeTemplate: "api/{controller}/{id}",
|
||||
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
namespace LaaProductionWeb.Areas.Administration
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
public class AdministrationAreaRegistration : AreaRegistration
|
||||
{
|
||||
public override string AreaName => "Administration";
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
context.MapRoute(
|
||||
name: "Administration_WithId",
|
||||
url: "Administration/{controller}/{action}/{id}",
|
||||
defaults: new { action = "Index", id = UrlParameter.Optional });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
@using LaaProductionWeb.App_Infrastructure
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="icon" type="image/svg" href="~/favicon.svg">
|
||||
|
||||
@Styles.Render("~/bootstrap_css")
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||
|
||||
@Styles.Render("~/styles_css")
|
||||
|
||||
<title>Laatzen Production Web</title>
|
||||
</head>
|
||||
<body class="d-flex flex-column vh-100 overflow-hidden">
|
||||
@if (this.User.IsInRole(UserRoles.WEB_Admin))
|
||||
{
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark shadow-sm">
|
||||
<div class="container-fluid">
|
||||
<button class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#mainnav" aria-controls="mainnav" aria-expanded="false">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="mainnav">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Administration/Software">Software</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/">Exit</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
}
|
||||
|
||||
<main class="h-100 scrollable">
|
||||
@this.RenderBody()
|
||||
</main>
|
||||
|
||||
@Scripts.Render("~/bootstrap_js")
|
||||
@Scripts.Render("~/barcodes_js")
|
||||
@Scripts.Render("~/scripts_js")
|
||||
@this.RenderSection("scripts", required: false)
|
||||
|
||||
</body>
|
||||
</html>
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Administration/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
@model IEnumerable<LaaProductionWeb.Areas.Administration.Models.Software.SoftwareOverviewModel>
|
||||
|
||||
@if (this.Model?.Any() ?? false)
|
||||
{
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
@foreach (var software in this.Model)
|
||||
{
|
||||
<a href="~/Administration/Software/SoftwareFunctions/@software.AppId" class="list-group-item list-group-item-action bg-light small d-flex justify-content-between text-dark">
|
||||
@software.Name <i class="bi bi-caret-right bi-small"></i>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
@{
|
||||
this.Layout = "~/Areas/Administration/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Controllers
|
||||
{
|
||||
using LaaProduction.Personalization;
|
||||
using LaaProductionHttp.Interfaces;
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Areas.Personalization.Models.Employees;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
|
||||
[RouteArea("Personalization")]
|
||||
[AllowedRoles(UsersRoles.WEB_Admin)]
|
||||
public class EmployeesController : Controller
|
||||
{
|
||||
private readonly IHttpClient httpClient;
|
||||
|
||||
public EmployeesController()
|
||||
=> this.httpClient = ServiceProvider.GetService<IHttpClient>();
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult> Index()
|
||||
{
|
||||
var employeesResponse = await this.httpClient
|
||||
.Get("/api/Personalization/Employees")
|
||||
.AuthorizeBearer(this.User.GetNameIdentifier())
|
||||
.SendAsync<IEnumerable<Employee>>();
|
||||
var employeeysModel = new EmployeesListModel();
|
||||
|
||||
if (employeesResponse.Succeeded)
|
||||
{
|
||||
employeeysModel.Employees = employeesResponse.Value ?? Array.Empty<Employee>();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ModelState.AddModelErrors(employeesResponse);
|
||||
}
|
||||
|
||||
return this.View(employeeysModel);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[RouteParameter("employeeId")]
|
||||
public async Task<ActionResult> Edit(short employeeId = 0)
|
||||
{
|
||||
var employeeResponse = await this.httpClient
|
||||
.Get($"/api/Personalization/Employees/Find/{employeeId}")
|
||||
.AuthorizeBearer(this.User.GetNameIdentifier())
|
||||
.SendAsync<EmployeeEditModel>();
|
||||
var employeeEditModel = new EmployeeEditModel();
|
||||
|
||||
if (employeeResponse.Succeeded)
|
||||
{
|
||||
employeeEditModel = employeeResponse.Value;
|
||||
|
||||
var rolesResponse = await this.httpClient
|
||||
.Get($"/api/Personalization/Roles/Find/{employeeId}")
|
||||
.AuthorizeBearer(this.User.GetNameIdentifier())
|
||||
.SendAsync<IDictionary<string, bool>>();
|
||||
|
||||
if (rolesResponse.Succeeded)
|
||||
{
|
||||
employeeEditModel.Roles = rolesResponse.Value ?? new Dictionary<string, bool>();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ModelState.AddModelErrors(rolesResponse);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ModelState.AddModelErrors(employeeResponse);
|
||||
}
|
||||
|
||||
return this.View(employeeEditModel);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> EditRoles(EmployeeEditRolesModel model)
|
||||
{
|
||||
var result = await this.httpClient
|
||||
.Post($"/api/Personalization/Employees/EditRoles")
|
||||
.AuthorizeBearer(this.User.GetNameIdentifier())
|
||||
.WhitJsonBody(model)
|
||||
.SendAsync<object>();
|
||||
|
||||
return this.Redirect($"~/Personalization/Employees/Edit/{model.EmployeeId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Controllers
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
[RouteArea("Personalization")]
|
||||
public class EmployeesFunctionsController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return this.View();
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Controllers
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
[RouteArea("Personalization")]
|
||||
public class EmployeesRolesController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return this.View();
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Controllers
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
[RouteArea("Presonalization")]
|
||||
public class PersonalizationController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return this.View();
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,23 +1,23 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Controllers
|
||||
namespace LaaProductionWeb.Areas.Personalization.Controllers
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Areas.Administration.Models.Software;
|
||||
using LaaProductionWeb.Areas.Personalization.Models.Software;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
[RouteArea("Administration")]
|
||||
[AllowedRoles(UserRoles.WEB_Admin)]
|
||||
[RouteArea("Personalization")]
|
||||
[AllowedRoles(UsersRoles.WEB_Admin)]
|
||||
public class SoftwareController : Controller
|
||||
{
|
||||
private readonly ISoftwareService softwareService;
|
||||
|
||||
public SoftwareController()
|
||||
=> this.softwareService = ServiceProvider.Current.GetService<ISoftwareService>();
|
||||
=> this.softwareService = ServiceProvider.GetService<ISoftwareService>();
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Index()
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Controllers
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
[RouteArea("Personalization")]
|
||||
public class SoftwareFunctionsController : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return this.View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Employees
|
||||
{
|
||||
public class Employee
|
||||
{
|
||||
public short EmployeeId { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
public int RolesCount { get; set; }
|
||||
|
||||
public int FunctionsCount { get; set; }
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Employees
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class EmployeeEditModel : Employee
|
||||
{
|
||||
public IDictionary<string, bool> Roles { get; set; }
|
||||
= new Dictionary<string, bool>();
|
||||
|
||||
public IDictionary<int, string> Functions { get; set; }
|
||||
= new Dictionary<int, string>();
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Employees
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class EmployeeEditRolesModel
|
||||
{
|
||||
[Required]
|
||||
public short? EmployeeId { get; set; }
|
||||
|
||||
public string[] Roles { get; set; }
|
||||
= Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Employees
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class EmployeesListModel
|
||||
{
|
||||
public IEnumerable<Employee> Employees { get; set; }
|
||||
= Array.Empty<Employee>();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
public class SoftwareFunctionModel
|
||||
{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
public class SoftwareOverviewModel
|
||||
{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
public class SoftwareUser
|
||||
{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace LaaProductionWeb.Areas.Administration.Models.Software
|
||||
namespace LaaProductionWeb.Areas.Personalization.Models.Software
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
namespace LaaProductionWeb.Areas.Personalization
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
public class PersonalizationAreaRegistration : AreaRegistration
|
||||
{
|
||||
public override string AreaName => "Personalization";
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
context.MapRoute(
|
||||
name: "Personalization_WithId",
|
||||
url: "Personalization/{controller}/{action}/{id}",
|
||||
defaults: new { controller = "Personalization", action = "Index", id = UrlParameter.Optional });
|
||||
|
||||
context.MapRoute(
|
||||
name: "Personalization_WithEmployeeId",
|
||||
url: "Personalization/{controller}/{action}/{employeeId}",
|
||||
defaults: new { controller = "Personalization", action = "Index", id = UrlParameter.Optional });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
@model EmployeeEditModel
|
||||
|
||||
@using LaaProductionWeb.Areas.Personalization.Models.Employees
|
||||
|
||||
<div class="container-fluid mt-3 mb-5">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
<a href="/Personalization/Employees" class="text-dark text-decoration-none">
|
||||
<i class="bi bi-bold bi-arrow-left small pe-3"></i>
|
||||
</a>
|
||||
@this.Model.FullName
|
||||
</h3>
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td class="px-3">MitarbeiterNr:</td>
|
||||
<td class="w-100 fw-bold">@this.Model.EmployeeId</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-3">Username:</td>
|
||||
<td class="w-100 fw-bold">@this.Model.Username</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-3">Name:</td>
|
||||
<td class="w-100 fw-bold">@this.Model.FullName</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr class="my-0" />
|
||||
<div class="small text-danger mb-5">
|
||||
@this.Html.ValidationSummary()
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-outline-success dropdown-toggle w-100 text-start" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Rechte: @this.Model.RolesCount
|
||||
</button>
|
||||
<div class="dropdown-menu w-100">
|
||||
<form action="~/Personalization/Employees/EditRoles" method="post" id="employee_roles" class="px-2 py-0">
|
||||
<input type="hidden" name="@nameof(this.Model.EmployeeId)" value="@this.Model.EmployeeId" />
|
||||
<div class="scrollable-sm" style="max-height: 300px">
|
||||
@{
|
||||
var r = 1;
|
||||
|
||||
foreach (var role in this.Model.Roles)
|
||||
{
|
||||
var id = $"r_{r++}";
|
||||
|
||||
<div class="form-check">
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
value="@role.Key"
|
||||
name="Roles[]"
|
||||
id="@id" @(role.Value ? "checked=\"checked\"" : null)>
|
||||
<label class="form-check-label">@role.Key</label>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<button class="btn btn-light btn-sm w-100 border fw-bold mt-3" type="submit">Aktualizieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<form>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-outline-primary dropdown-toggle w-100 text-start" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
Funktionen: @this.Model.FunctionsCount
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#">Action</a></li>
|
||||
<li><a class="dropdown-item" href="#">Another action</a></li>
|
||||
<li><a class="dropdown-item" href="#">Something else here</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<a class="btn btn-light d-block border-dark">
|
||||
<i class="bi bi-exclamation-circle"></i>
|
||||
Password zurücksetzen
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,79 @@
|
||||
@model EmployeesListModel
|
||||
|
||||
@using LaaProductionWeb.Areas.Personalization.Models.Employees
|
||||
|
||||
<div class="container-fluid mt-3 mb-5">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-5">
|
||||
<h3>Mitarbeiter</h3>
|
||||
<hr class="my-0" />
|
||||
<div class="small text-danger mb-5">
|
||||
@this.Html.ValidationSummary()
|
||||
</div>
|
||||
<input id="employee_filter" type="search" class="form-control form-control-sm px-3 py-2" placeholder="Mitarbeiter filtern" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Mitarbeitername</th>
|
||||
<th>Bunutzername</th>
|
||||
<th>Anzahl Rechte</th>
|
||||
<th>Anzahl Funktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var employee in this.Model.Employees)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/Personalization/Employees/Edit/@employee.EmployeeId" class="btn btn-light border-0 rounded-0 py-0 d-block text-start hover-dots">
|
||||
@employee.FullName
|
||||
</a>
|
||||
</td>
|
||||
<td>@employee.Username</td>
|
||||
<td>@employee.RolesCount</td>
|
||||
<td>@employee.FunctionsCount</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
document
|
||||
.getElementById('employee_filter')
|
||||
.oninput = function (e) {
|
||||
let filter = e.target.value.toLowerCase();
|
||||
let trs = document.querySelectorAll('tbody > tr');
|
||||
if (filter) {
|
||||
trs.forEach(function (tr) {
|
||||
let children = tr.children;
|
||||
let length = children.length;
|
||||
let text = '';
|
||||
|
||||
for (var c = 0; c < length; c++) {
|
||||
text += children[c].textContent;
|
||||
}
|
||||
|
||||
text = text.toLowerCase();
|
||||
|
||||
if (text.includes(filter) || filter.includes(text)) {
|
||||
tr.classList.remove('d-none');
|
||||
} else {
|
||||
tr.classList.add('d-none');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
trs.forEach(function (tr) {
|
||||
tr.classList.remove('d-none');
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<h2>Mitarbeiter Funktionen</h2>
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<h2>Mitarbeiter Rechte</h2>
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<div class="container-fluid my-3">
|
||||
<h3>Personalisierung</h3>
|
||||
</div>
|
||||
@@ -0,0 +1,64 @@
|
||||
@using LaaProduction.Personalization
|
||||
@using LaaProductionWeb.App_Infrastructure
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="icon" type="image/svg" href="~/favicon.svg">
|
||||
|
||||
@Styles.Render("~/bootstrap_css")
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||
|
||||
@Styles.Render("~/styles_css")
|
||||
|
||||
<title>Laatzen Production Web</title>
|
||||
</head>
|
||||
<body class="d-flex flex-column vh-100 overflow-hidden">
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark shadow-sm">
|
||||
<div class="container-fluid px-0">
|
||||
<button class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#mainnav" aria-controls="mainnav" aria-expanded="false">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="mainnav">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Personalization/Employees">Mitarbeiter</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Personalization/EmployeesRoles">Mitarbeiter Rechte</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Personalization/EmployeesFunctions">Mitarbeiter Funktionen</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Personalization/SoftwareFunctions">Software Funktionen</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Personalization/Software">Software</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/"><i class="bi bi-box-arrow-right"></i> @this.User.FullName()</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="h-100 scrollable">
|
||||
@this.RenderBody()
|
||||
</main>
|
||||
|
||||
@Scripts.Render("~/bootstrap_js")
|
||||
@Scripts.Render("~/barcodes_js")
|
||||
@Scripts.Render("~/scripts_js")
|
||||
@this.RenderSection("scripts", required: false)
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Personalization/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<a href="~/Personalization/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Personalization/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Personalization/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
+7
-7
@@ -1,13 +1,13 @@
|
||||
@model LaaProductionWeb.Areas.Administration.Models.Software.SoftwareModel
|
||||
@model LaaProductionWeb.Areas.Personalization.Models.Software.SoftwareModel
|
||||
|
||||
<div class="container-fluid h-100">
|
||||
<div class="row h-100">
|
||||
<div class="col-2 bg-light">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light active">Software</a>
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Administration/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
<a href="~/Personalization/Software" class="list-group-item list-group-item-action bg-light active">Software</a>
|
||||
<a href="~/Personalization/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Personalization/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Personalization/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0">
|
||||
@@ -28,8 +28,8 @@
|
||||
<tr>
|
||||
<td>@item.AppId</td>
|
||||
<td class="text-smallcaps">@item.Name</td>
|
||||
<td><a href="~/Administration/Software/SoftwareVersions/@item.AppId" class="btn btn-sm btn-light border-0 d-block text-start fw-bold">@item.Versions</a></td>
|
||||
<td><a href="~/Administration/Software/SoftwareFunctions/@item.AppId" class="btn btn-sm btn-light border-0 d-block text-start text-smallcaps fw-bold">@item.Functions</a></td>
|
||||
<td><a href="~/Personalization/Software/SoftwareVersions/@item.AppId" class="btn btn-sm btn-light border-0 d-block text-start fw-bold">@item.Versions</a></td>
|
||||
<td><a href="~/Personalization/Software/SoftwareFunctions/@item.AppId" class="btn btn-sm btn-light border-0 d-block text-start text-smallcaps fw-bold">@item.Functions</a></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
@model LaaProductionWeb.Areas.Administration.Models.Software.SoftwareFunctionsModel
|
||||
@model LaaProductionWeb.Areas.Personalization.Models.Software.SoftwareFunctionsModel
|
||||
|
||||
@{
|
||||
var softwareSelected = (this.Model?.AppId ?? 0) > 0;
|
||||
@@ -9,10 +9,10 @@
|
||||
<div class="row h-100 overflow-hidden">
|
||||
<div class="col-2 bg-light h-100">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<a href="~/Personalization/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
@if (softwareSelected)
|
||||
{
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light active">
|
||||
<a href="~/Personalization/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light active">
|
||||
<i class="bi bi-caret-left-fill bi-small"></i> Software Functions
|
||||
</a>
|
||||
<div class="list-group-item list-group-item-action bg-light">
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light active">
|
||||
<a href="~/Personalization/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light active">
|
||||
Software Functions
|
||||
</a>
|
||||
<div class="list-group-item list-group-item-action bg-light">
|
||||
@@ -49,8 +49,8 @@
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<a href="~/Administration/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
<a href="~/Personalization/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Personalization/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0 h-100 scrollable-sm">
|
||||
@@ -86,7 +86,7 @@
|
||||
Users
|
||||
</button>
|
||||
<div class="dropdown-menu w-100">
|
||||
<form action="~/Administration/Software/SoftwareFunctions" method="post" id="form_@function.Id" class="px-3">
|
||||
<form action="~/Personalization/Software/SoftwareFunctions" method="post" id="form_@function.Id" class="px-3">
|
||||
<input type="hidden" name="FunctionId" value="@function.Id" />
|
||||
<input class="form-control form-control-sm" id="user_serach_@function.Id" />
|
||||
<div class="scrollable-sm mt-3" style="max-height: 500px">
|
||||
@@ -136,7 +136,7 @@
|
||||
Users
|
||||
</button>
|
||||
<div class="dropdown-menu w-100">
|
||||
<form action="~/Administration/Software/SoftwareFunctions" method="post" id="form_@function.Id" class="px-3">
|
||||
<form action="~/Personalization/Software/SoftwareFunctions" method="post" id="form_@function.Id" class="px-3">
|
||||
<input type="hidden" name="FunctionId" value="@function.Id" />
|
||||
<input class="form-control form-control-sm" id="user_serach_@function.Id" />
|
||||
<div class="scrollable-sm" style="max-height: 500px">
|
||||
@@ -200,7 +200,7 @@
|
||||
function addFunction(funcName) {
|
||||
fetchOptions.body = JSON.stringify({ AppId: appId, Function: funcName });
|
||||
|
||||
fetch('@this.Url.Content("~/Administration/Software/AddFunction")', fetchOptions)
|
||||
fetch('@this.Url.Content("~/Personalization/Software/AddFunction")', fetchOptions)
|
||||
.then(response => response.text())
|
||||
.then(text => showError(0, text));
|
||||
}
|
||||
@@ -208,7 +208,7 @@
|
||||
function editFunction(funcId, funcName) {
|
||||
fetchOptions.body = JSON.stringify({ AppId: appId, FuncId: funcId, Function: funcName });
|
||||
|
||||
fetch('@this.Url.Content("~/Administration/Software/EditFunction")', fetchOptions)
|
||||
fetch('@this.Url.Content("~/Personalization/Software/EditFunction")', fetchOptions)
|
||||
.then(response => response.text())
|
||||
.then(text => showError(funcId, text));
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
@model IEnumerable<LaaProductionWeb.Areas.Personalization.Models.Software.SoftwareOverviewModel>
|
||||
|
||||
@if (this.Model?.Any() ?? false)
|
||||
{
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
@foreach (var software in this.Model)
|
||||
{
|
||||
<a href="~/Personalization/Software/SoftwareFunctions/@software.AppId" class="list-group-item list-group-item-action bg-light small d-flex justify-content-between text-dark">
|
||||
@software.Name <i class="bi bi-caret-right bi-small"></i>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
@model LaaProductionWeb.Areas.Administration.Models.Software.SoftwareVersionsModel
|
||||
@model LaaProductionWeb.Areas.Personalization.Models.Software.SoftwareVersionsModel
|
||||
|
||||
<div class="container-fluid h-100">
|
||||
<div class="row h-100 overflow-hidden">
|
||||
<div class="col-2 bg-light h-100">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light active"><i class="bi bi-caret-left-fill bi-small"></i> Software</a>
|
||||
<a href="~/Personalization/Software" class="list-group-item list-group-item-action bg-light active"><i class="bi bi-caret-left-fill bi-small"></i> Software</a>
|
||||
<div class="list-group-item list-group-item-action bg-light">
|
||||
<table class="table table-sm table-borderless w-100 m-0">
|
||||
<tbody>
|
||||
@@ -21,15 +21,15 @@
|
||||
<td class="text-smallcaps small">@this.Model.Versions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-smallcaps small"><a href="~/Administration/Software/SoftwareFunctions/@this.Model.AppId">Functions</a></td>
|
||||
<td class="text-smallcaps small"><a href="~/Personalization/Software/SoftwareFunctions/@this.Model.AppId">Functions</a></td>
|
||||
<td class="text-smallcaps small">@this.Model.Functions</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Administration/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
<a href="~/Personalization/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Personalization/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Personalization/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0 h-100 scrollable-sm">
|
||||
+10
-9
@@ -1,24 +1,25 @@
|
||||
@model IEnumerable<LaaProductionWeb.Areas.Administration.Models.Software.SoftwareUser>
|
||||
@model IEnumerable<LaaProductionWeb.Areas.Personalization.Models.Software.SoftwareUser>
|
||||
|
||||
@using LaaProduction.Personalization
|
||||
@using LaaProductionWeb.App_Infrastructure
|
||||
|
||||
<div class="container-fluid h-100">
|
||||
<div class="row h-100 overflow-hidden">
|
||||
<div class="col-2 bg-light h-100">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Administration/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light active">Users</a>
|
||||
<a href="~/Personalization/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<a href="~/Personalization/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Personalization/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light">Users Functions</a>
|
||||
<a href="~/Personalization/Software/Users" class="list-group-item list-group-item-action bg-light active">Users</a>
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<div class="list-group-item list-group-item-action bg-light">
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control form-control-sm" id="user_search">
|
||||
</div>
|
||||
</div>
|
||||
@if (this.User.IsInRole(UserRoles.WEB_Admin))
|
||||
@if (this.User.IsInRole(UsersRoles.WEB_Admin))
|
||||
{
|
||||
<a href="~/Administration/Software/UpdatePWDS" class="list-group-item list-group-item-action bg-light small active border-0 py-0">Update users passwords</a>
|
||||
<a href="~/Personalization/Software/UpdatePWDS" class="list-group-item list-group-item-action bg-light small active border-0 py-0">Update users passwords</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +45,7 @@
|
||||
<td>@user.LastName</td>
|
||||
<td>@user.Username</td>
|
||||
<td>
|
||||
<a class="btn btn-sm btn-light border-0 w-100 text-start fw-bold" href="~/Administration/Software/UsersFunctions/@user.Id">
|
||||
<a class="btn btn-sm btn-light border-0 w-100 text-start fw-bold" href="~/Personalization/Software/UsersFunctions/@user.Id">
|
||||
@user.FunctionsCount
|
||||
</a>
|
||||
</td>
|
||||
@@ -72,7 +73,7 @@
|
||||
activeLinks.forEach(a => a.onklick = function resetPassword (e) {
|
||||
if (e.target.id) {
|
||||
let id = e.target.id.replace('pwd_', '');
|
||||
fetch('@this.Url.Content("~/Administration/Software/ResetPWD")', {
|
||||
fetch('@this.Url.Content("~/Personalization/Software/ResetPWD")', {
|
||||
credentials: 'same-origin',
|
||||
mode: 'same-origin',
|
||||
method: 'POST',
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
@model LaaProductionWeb.Areas.Administration.Models.Software.UsersFunctionsModel
|
||||
@model LaaProductionWeb.Areas.Personalization.Models.Software.UsersFunctionsModel
|
||||
|
||||
@using System.Linq
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<div class="row h-100 overflow-hidden">
|
||||
<div class="col-2 bg-light h-100">
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<a href="~/Administration/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<a href="~/Administration/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Administration/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light active">Users Functions</a>
|
||||
<a href="~/Personalization/Software" class="list-group-item list-group-item-action bg-light">Software</a>
|
||||
<a href="~/Personalization/Software/SoftwareFunctions" class="list-group-item list-group-item-action bg-light">Software Functions</a>
|
||||
<a href="~/Personalization/Software/UsersFunctions" class="list-group-item list-group-item-action bg-light active">Users Functions</a>
|
||||
<div class="list-group list-group-flush list-group-transparent">
|
||||
<div class="list-group-item list-group-item-action bg-light">
|
||||
<div class="input-group input-group-sm">
|
||||
@@ -16,7 +16,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="~/Administration/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
<a href="~/Personalization/Software/Users" class="list-group-item list-group-item-action bg-light">Users</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 p-0 h-100 scrollable-sm">
|
||||
@@ -44,7 +44,7 @@
|
||||
@user.FunctionsCount Functionen
|
||||
</button>
|
||||
<div class="dropdown-menu w-100">
|
||||
<form action="~/Administration/Software/UsersFunctions" method="post" id="form_@user.Id" class="p-3">
|
||||
<form action="~/Personalization/Software/UsersFunctions" method="post" id="form_@user.Id" class="p-3">
|
||||
<input type="hidden" name="UserId" value="@user.Id" />
|
||||
<div class="scrollable-sm mt-3" style="max-height: 500px">
|
||||
@foreach (var f in this.Model.Functions)
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<h2>Software Funktionen</h2>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
this.Layout = "~/Areas/Personalization/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
private readonly ISearchService searchService;
|
||||
|
||||
public WildcardController()
|
||||
=> this.searchService = ServiceProvider.Current.GetService<ISearchService>();
|
||||
=> this.searchService = ServiceProvider.GetService<ISearchService>();
|
||||
|
||||
[HttpOptions]
|
||||
public IHttpActionResult Options()
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
public AppIdController()
|
||||
{
|
||||
this.softwareService = ServiceProvider.Current.GetService<ISoftwareService>();
|
||||
this.loggerService = ServiceProvider.Current.GetService<ILoggerService>();
|
||||
this.softwareService = ServiceProvider.GetService<ISoftwareService>();
|
||||
this.loggerService = ServiceProvider.GetService<ILoggerService>();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
public FunctionsController()
|
||||
{
|
||||
this.accountService = ServiceProvider.Current.GetService<IAccountService>();
|
||||
this.softwareService = ServiceProvider.Current.GetService<ISoftwareService>();
|
||||
this.loggerService = ServiceProvider.Current.GetService<ILoggerService>();
|
||||
this.accountService = ServiceProvider.GetService<IAccountService>();
|
||||
this.softwareService = ServiceProvider.GetService<ISoftwareService>();
|
||||
this.loggerService = ServiceProvider.GetService<ILoggerService>();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
namespace LaaProductionWeb.Controllers.API.Personalization
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Http;
|
||||
|
||||
[AuthorizeBearer]
|
||||
public class EmployeesController : ApiController
|
||||
{
|
||||
private readonly IEmployeesManager employeesManager;
|
||||
|
||||
public EmployeesController()
|
||||
=> this.employeesManager = ServiceProvider.GetService<IEmployeesManager>();
|
||||
|
||||
[HttpGet]
|
||||
public IHttpActionResult Get()
|
||||
{
|
||||
var employees = this.employeesManager.GetEmployees();
|
||||
|
||||
return this.Json(employees);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IHttpActionResult Find(short id)
|
||||
{
|
||||
var employee = this.employeesManager.GetEmployee(id);
|
||||
|
||||
return this.Json(employee);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IHttpActionResult EditRoles([FromBody] EditRolesModel model)
|
||||
{
|
||||
if (this.ModelState.IsValid)
|
||||
{
|
||||
this.employeesManager.UpdateEmployeeRoles(model.EmployeeId.Value, model.Roles);
|
||||
}
|
||||
|
||||
return this.Json(true);
|
||||
}
|
||||
}
|
||||
|
||||
public class EditRolesModel
|
||||
{
|
||||
[Required]
|
||||
public short? EmployeeId { get; set; }
|
||||
|
||||
public string[] Roles { get; set; }
|
||||
= Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,16 +1,16 @@
|
||||
namespace LaaProductionWeb.Controllers.API.Account
|
||||
{
|
||||
using LaaProduction.Administration.Interfaces;
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web.Http;
|
||||
|
||||
public class LoginController : ApiController
|
||||
{
|
||||
private readonly IAccountManagement accountManagement;
|
||||
private readonly IAccountManager accountManagement;
|
||||
|
||||
public LoginController()
|
||||
=> this.accountManagement = ServiceProvider.Current.GetService<IAccountManagement>();
|
||||
=> this.accountManagement = ServiceProvider.GetService<IAccountManager>();
|
||||
|
||||
[HttpPost]
|
||||
public IHttpActionResult Post(LoginPostModel model)
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace LaaProductionWeb.Controllers.API.Personalization
|
||||
{
|
||||
using LaaProduction.Personalization.Interfaces;
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
|
||||
using System.Web.Http;
|
||||
|
||||
[AuthorizeBearer]
|
||||
public class RolesController : ApiController
|
||||
{
|
||||
private readonly IEmployeesManager employeesManager;
|
||||
|
||||
public RolesController()
|
||||
=> this.employeesManager = ServiceProvider.GetService<IEmployeesManager>();
|
||||
|
||||
[HttpGet]
|
||||
public IHttpActionResult Get()
|
||||
{
|
||||
var employeeRoles = this.employeesManager.GetRoles();
|
||||
|
||||
return this.Json(employeeRoles);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IHttpActionResult Find(short id)
|
||||
{
|
||||
var employeeRoles = this.employeesManager.GetRoles(id);
|
||||
|
||||
return this.Json(employeeRoles);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
|
||||
using System.Web.Mvc;
|
||||
|
||||
[AllowedRoles(UserRoles.WEB_Admin)]
|
||||
[AllowedRoles(UsersRoles.WEB_Admin)]
|
||||
public class AdminController : Controller
|
||||
{
|
||||
private readonly IAccountService accountService;
|
||||
|
||||
public AdminController()
|
||||
=> this.accountService = ServiceProvider.Current.GetService<IAccountService>();
|
||||
=> this.accountService = ServiceProvider.GetService<IAccountService>();
|
||||
|
||||
public ActionResult Index()
|
||||
=> this.View();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
@@ -9,19 +9,19 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
|
||||
[AllowedRoles(UserRoles.WEB_ProdApproval)]
|
||||
[AllowedRoles(UsersRoles.WEB_ProdApproval)]
|
||||
public class ApprovalsController : Controller
|
||||
{
|
||||
private readonly IApprovalsService approvals;
|
||||
|
||||
public ApprovalsController()
|
||||
=> this.approvals = ServiceProvider.Current.GetService<IApprovalsService>();
|
||||
=> this.approvals = ServiceProvider.GetService<IApprovalsService>();
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Add()
|
||||
=> this.View(new ProductionApproval
|
||||
{
|
||||
ApproverName = this.User.DisplayName(),
|
||||
ApproverName = this.User.FullName(),
|
||||
ApprovalDate = DateTime.Now
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
if (this.ModelState.IsValid)
|
||||
{
|
||||
approval.ApprovalDate = DateTime.Now;
|
||||
approval.ApproverName = this.User.DisplayName();
|
||||
approval.ApproverName = this.User.FullName();
|
||||
|
||||
var addResult = this.approvals.Add(approval);
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
public HomeController()
|
||||
{
|
||||
this.accountService = ServiceProvider.Current.GetService<IAccountService>();
|
||||
this.httpClient = ServiceProvider.Current.GetService<IHttpClient>();
|
||||
this.accountService = ServiceProvider.GetService<IAccountService>();
|
||||
this.httpClient = ServiceProvider.GetService<IHttpClient>();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -45,9 +45,9 @@
|
||||
.Name;
|
||||
|
||||
var token = await this.httpClient
|
||||
.PostMessage("/api/Account/Login")
|
||||
.Post("/api/Personalization/Login")
|
||||
.WhitJsonBody(new { username, password, software })
|
||||
.SendAsync<string, Dictionary<string, string>>();
|
||||
.SendAsync<string>();
|
||||
|
||||
if (!token.Succeeded)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
using System.Web.Mvc;
|
||||
|
||||
[AllowedRoles(UserRoles.WEB_PuneProtokoll)]
|
||||
[AllowedRoles(UsersRoles.WEB_PuneProtokoll)]
|
||||
public class ProtocolController : Controller
|
||||
{
|
||||
public const string FilePDF = nameof(FilePDF);
|
||||
@@ -16,7 +16,7 @@
|
||||
private readonly IProtocolService protocolService;
|
||||
|
||||
public ProtocolController()
|
||||
=> this.protocolService = ServiceProvider.Current.GetService<IProtocolService>();
|
||||
=> this.protocolService = ServiceProvider.GetService<IProtocolService>();
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Index(int orderId = 0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
@@ -9,13 +9,13 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
|
||||
[AllowedRoles(UserRoles.WEB_HeReport)]
|
||||
[AllowedRoles(UsersRoles.WEB_HeReport)]
|
||||
public class ReportController : Controller
|
||||
{
|
||||
private readonly IReportService reportService;
|
||||
|
||||
public ReportController()
|
||||
=> this.reportService = ServiceProvider.Current.GetService<IReportService>();
|
||||
=> this.reportService = ServiceProvider.GetService<IReportService>();
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Helium()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
public SearchController()
|
||||
{
|
||||
this.ordersService = ServiceProvider.Current.GetService<IOrdersService>();
|
||||
this.httpService = ServiceProvider.Current.GetService<IHttpService>();
|
||||
this.ordersService = ServiceProvider.GetService<IOrdersService>();
|
||||
this.httpService = ServiceProvider.GetService<IHttpService>();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -64,7 +64,7 @@
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[AllowedRoles(UserRoles.WEB_API_Explorer)]
|
||||
[AllowedRoles(UsersRoles.WEB_API_Explorer)]
|
||||
public async Task<ActionResult> Wildcard(SearchWildcardModel model)
|
||||
{
|
||||
var fields = string.Empty;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LaaProductionWeb.Controllers
|
||||
{
|
||||
using LaaProduction.Administration;
|
||||
using LaaProduction.Personalization;
|
||||
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
using LaaProductionWeb.Services.Interfaces;
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
using SystemFile = System.IO.File;
|
||||
|
||||
[AllowedRoles(UserRoles.WEB_PalettenScan)]
|
||||
[AllowedRoles(UsersRoles.WEB_PalettenScan)]
|
||||
public class ShipmentsController : Controller
|
||||
{
|
||||
private readonly IShipmentsService shipmentsService;
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
public ShipmentsController()
|
||||
{
|
||||
this.shipmentsService = ServiceProvider.Current.GetService<IShipmentsService>();
|
||||
this.httpService = ServiceProvider.Current.GetService<IHttpService>();
|
||||
this.shipmentsService = ServiceProvider.GetService<IShipmentsService>();
|
||||
this.httpService = ServiceProvider.GetService<IHttpService>();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
||||
@@ -158,29 +158,40 @@
|
||||
<Compile Include="App_Infrastructure\AllowedRolesAttribute.cs" />
|
||||
<Compile Include="App_Infrastructure\Appsettings.cs" />
|
||||
<Compile Include="App_Infrastructure\AuthorizationFilter.cs" />
|
||||
<Compile Include="App_Infrastructure\AuthorizeBearerAttribute.cs" />
|
||||
<Compile Include="App_Infrastructure\HttpExtensions.cs" />
|
||||
<Compile Include="App_Infrastructure\ExceptionFilter.cs" />
|
||||
<Compile Include="App_Infrastructure\RouteParameterAttribute.cs" />
|
||||
<Compile Include="App_Infrastructure\ServiceProvider.cs" />
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="App_Start\WebApiConfig.cs" />
|
||||
<Compile Include="Areas\Administration\AdministrationAreaRegistration.cs" />
|
||||
<Compile Include="Areas\Administration\Controllers\SoftwareController.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\AddFunctionModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\EditFunctionModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\FunctionUsersInputModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareEditModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareFunctionModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareFunctionsModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareOverviewModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareUser.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareVersionModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\SoftwareVersionsModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\UserFunctions.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\UsersFunctionsInputModel.cs" />
|
||||
<Compile Include="Areas\Administration\Models\Software\UsersFunctionsModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Controllers\EmployeesController.cs" />
|
||||
<Compile Include="Areas\Personalization\Controllers\EmployeesFunctionsController.cs" />
|
||||
<Compile Include="Areas\Personalization\Controllers\EmployeesRolesController.cs" />
|
||||
<Compile Include="Areas\Personalization\Controllers\PersonalizationController.cs" />
|
||||
<Compile Include="Areas\Personalization\Controllers\SoftwareFunctionsController.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Employees\Employee.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Employees\EmployeeEditModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Employees\EmployeeEditRolesModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Employees\EmployeesListModel.cs" />
|
||||
<Compile Include="Areas\Personalization\PersonalizationAreaRegistration.cs" />
|
||||
<Compile Include="Areas\Personalization\Controllers\SoftwareController.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\AddFunctionModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\EditFunctionModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\FunctionUsersInputModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\SoftwareEditModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\SoftwareFunctionModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\SoftwareFunctionsModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\SoftwareModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\SoftwareOverviewModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\SoftwareUser.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\SoftwareVersionModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\SoftwareVersionsModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\UserFunctions.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\UsersFunctionsInputModel.cs" />
|
||||
<Compile Include="Areas\Personalization\Models\Software\UsersFunctionsModel.cs" />
|
||||
<Compile Include="Areas\Serach\Controllers\WildcardController.cs" />
|
||||
<Compile Include="Areas\Shipment\Controllers\ScannedController.cs" />
|
||||
<Compile Include="Areas\Shipment\Models\Interfaces\IScanModel.cs" />
|
||||
@@ -189,7 +200,9 @@
|
||||
<Compile Include="Areas\Software\Controllers\FunctionsController.cs" />
|
||||
<Compile Include="Areas\Software\SoftwareAreaRegistration.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Controllers\API\Account\LoginController.cs" />
|
||||
<Compile Include="Controllers\API\Personalization\EmployeesController.cs" />
|
||||
<Compile Include="Controllers\API\Personalization\LoginController.cs" />
|
||||
<Compile Include="Controllers\API\Personalization\RolesController.cs" />
|
||||
<Compile Include="Controllers\ApprovalsController.cs" />
|
||||
<Compile Include="Controllers\EmailController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
@@ -228,16 +241,16 @@
|
||||
<Content Include="App_Content\font\fonts\bootstrap-icons.woff" />
|
||||
<Content Include="App_Content\font\fonts\bootstrap-icons.woff2" />
|
||||
<Content Include="App_Data\client_map.json" />
|
||||
<Content Include="Areas\Administration\Views\_ViewStart.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Shared\_Layout.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Shared\_SoftwareSidebar.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\Index.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\SoftwareFunctions.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\SoftwareListGroup.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\SoftwareVersions.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\Users.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\Software\UsersFunctions.cshtml" />
|
||||
<Content Include="Areas\Administration\Views\web.config" />
|
||||
<Content Include="Areas\Personalization\Views\_ViewStart.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Shared\_Layout.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Shared\_SoftwareSidebar.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Software\Index.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Software\SoftwareFunctions.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Software\SoftwareListGroup.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Software\SoftwareVersions.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Software\Users.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Software\UsersFunctions.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\web.config" />
|
||||
<Content Include="Views\_ViewStart.cshtml" />
|
||||
<Content Include="Views\Admin\Index.cshtml" />
|
||||
<Content Include="Views\Approvals\Add.cshtml" />
|
||||
@@ -268,13 +281,19 @@
|
||||
<Content Include="Views\Shipments\Print.cshtml" />
|
||||
<Content Include="Views\Shipments\Scan.cshtml" />
|
||||
<Content Include="Views\Web.config" />
|
||||
<Content Include="Areas\Personalization\Views\Personalization\Index.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Employees\Index.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\EmployeesRoles\Index.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\EmployeesFunctions\Index.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\SoftwareFunctions\Index.cshtml" />
|
||||
<Content Include="Areas\Personalization\Views\Employees\Edit.cshtml" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LaaProduction.Administration\LaaProduction.Administration.csproj">
|
||||
<Project>{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}</Project>
|
||||
<Name>LaaProduction.Administration</Name>
|
||||
<ProjectReference Include="..\LaaProduction.Personalization\LaaProduction.Personalization.csproj">
|
||||
<Project>{4c17fd42-7002-431a-8d6e-c57dd7d7c2d2}</Project>
|
||||
<Name>LaaProduction.Personalization</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LaaProductionWeb.Services\LaaProductionWeb.Services.csproj">
|
||||
<Project>{ff167011-431a-41a7-a7db-560e08860388}</Project>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@using LaaProduction.Administration
|
||||
@using LaaProduction.Personalization
|
||||
@using LaaProductionWeb.App_Infrastructure
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -10,7 +10,6 @@
|
||||
<link rel="icon" type="image/svg" href="~/favicon.svg">
|
||||
|
||||
@Styles.Render("~/bootstrap_css")
|
||||
@*@Styles.Render("~/bootstrap_icons")*@
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||
|
||||
@@ -28,19 +27,19 @@
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="mainnav">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
@if (this.User.IsInRole(UserRoles.WEB_PalettenScan))
|
||||
@if (this.User.IsInRole(UsersRoles.WEB_PalettenScan))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Shipments">Paletten Scan</a>
|
||||
</li>
|
||||
}
|
||||
@if (this.User.IsInRole(UserRoles.WEB_PuneProtokoll))
|
||||
@if (this.User.IsInRole(UsersRoles.WEB_PuneProtokoll))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Protocol">Prüfprotokoll</a>
|
||||
</li>
|
||||
}
|
||||
@if (this.User.IsInRole(UserRoles.WEB_HeReport))
|
||||
@if (this.User.IsInRole(UsersRoles.WEB_HeReport))
|
||||
{
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link text-smallcaps dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" href="#">Reports</a>
|
||||
@@ -51,7 +50,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
@if (this.User.IsInRole(UserRoles.WEB_ProdApproval))
|
||||
@if (this.User.IsInRole(UsersRoles.WEB_ProdApproval))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-smallcaps" href="~/Approvals/Add">Production Approval</a>
|
||||
@@ -59,19 +58,19 @@
|
||||
}
|
||||
</ul>
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
@if (this.User.IsInRole(UserRoles.WEB_Admin))
|
||||
@if (this.User.IsInRole(UsersRoles.WEB_Admin))
|
||||
{
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link text-smallcaps dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" href="#">@this.User.DisplayName()</a>
|
||||
<a class="nav-link text-smallcaps dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" href="#">@this.User.FullName()</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a class="dropdown-item" href="~/Administration/Software">Software</a></li>
|
||||
<li><a class="dropdown-item" href="~/Personalization">Personalisierung</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<span class="nav-link text-smallcaps">Benutzer: @this.User.DisplayName()</span>
|
||||
<span class="nav-link text-smallcaps">Benutzer: @this.User.FullName()</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user