This commit is contained in:
2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
namespace Kreta.Naplo.Domain.V3.Common
{
public class ApiSecurity
{
public ApiSecurity(string accessTokenRaw, string securityKey)
{
AccessTokenRaw = accessTokenRaw;
SecurityKey = securityKey;
Signature = AccessTokenRaw.Split('.')[2];
}
public string AccessTokenRaw { get; private set; }
public string SecurityKey { get; private set; }
public string Signature { get; private set; }
}
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using Kreta.DataAccessManual.Interfaces;
using Kreta.Naplo.Dao.V3.Naplo;
using Kreta.Naplo.Domain.V3.Enum;
namespace Kreta.Naplo.Domain.V3.Common
{
public class DefaultConnectionParameters
{
public string IntezmenyAzonosito { get; }
public int IntezmenyId { get; }
public int TanevId { get; }
public int TanevSorszam { get; }
public int FelhasznaloId { get; }
public IEnumerable<FelhasznaloSzerepkor> JogosultsagLista { get; }
public IDalHandler DalHandler { get; set; }
public string UserName { get; }
public Guid UserIdpUniqueId { get; }
public Guid InstituteUniqueId { get; }
public DefaultConnectionParameters(MobileUser mobileUser, IntezmenyAdatokDao intezmenyAdatok, string intezmenyAzonosito)
{
IntezmenyAzonosito = intezmenyAzonosito;
FelhasznaloId = mobileUser.UserId;
JogosultsagLista = mobileUser.Roles;
UserName = mobileUser.UserName;
UserIdpUniqueId = mobileUser.UserIdpUniqueId;
TanevId = intezmenyAdatok.TanevId;
TanevSorszam = intezmenyAdatok.TanevSorszam;
IntezmenyId = intezmenyAdatok.IntezmenyId;
InstituteUniqueId = mobileUser.InstituteUniqueId;
}
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using Kreta.Naplo.Domain.V3.Enum;
namespace Kreta.Naplo.Domain.V3.Common
{
public class MobileUser
{
private const int MinimumIdentifierValue = 1;
public MobileUser(string instituteCode, int userId, string userName, IEnumerable<FelhasznaloSzerepkor> roles, int schoolYearId, Guid userIdpUniqueId, Guid instituteUniqueId)
{
if (string.IsNullOrWhiteSpace(instituteCode))
{
throw new ArgumentException($"{nameof(instituteCode)} cannot be null or whitespace");
}
InstituteCode = instituteCode;
if (userId < MinimumIdentifierValue)
{
throw new ArgumentException($"{nameof(userId)} must be greater or equal to {MinimumIdentifierValue}");
}
UserId = userId;
if (string.IsNullOrWhiteSpace(userName))
{
throw new ArgumentException($"{nameof(userName)} cannot be null or whitespace");
}
UserName = userName;
if (roles == null)
{
throw new ArgumentNullException(nameof(roles));
}
Roles = roles;
if (schoolYearId < MinimumIdentifierValue)
{
throw new ArgumentException($"{nameof(schoolYearId)} must be greater or equal to {MinimumIdentifierValue}");
}
SchoolYearId = schoolYearId;
UserIdpUniqueId = userIdpUniqueId;
InstituteUniqueId = instituteUniqueId;
}
public string InstituteCode { get; }
public int SchoolYearId { get; }
public IEnumerable<FelhasznaloSzerepkor> Roles { get; }
public int UserId { get; }
public string UserName { get; }
public Guid UserIdpUniqueId { get; }
public Guid InstituteUniqueId { get; }
}
}