mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 14:16:31 +00:00
queue + local sqlite WIP
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
|
||||
public class ApiConfig
|
||||
{
|
||||
public string Url { get; set; } = null!;
|
||||
public int RetryCount {get;set;}
|
||||
public double TimeoutSeconds { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
|
||||
public class ApiCredentials(string email, string password) : EventArgs
|
||||
{
|
||||
public string Email { get; set; } = email;
|
||||
public string Password { get; set; } = password;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
|
||||
public class HardwareInfo
|
||||
{
|
||||
public string CPU { get; set; } = null!;
|
||||
public string GPU { get; set; } = null!;
|
||||
public string MacAddress { get; set; } = null!;
|
||||
public string Memory { get; set; } = null!;
|
||||
|
||||
public string Hash { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
|
||||
public class LoginResponse
|
||||
{
|
||||
public string Token { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
|
||||
public enum RoleEnum
|
||||
{
|
||||
None = 0,
|
||||
Operator = 10, //only annotator is available. Could send annotations to queue.
|
||||
Validator = 20, //annotator + dataset explorer. This role allows to receive annotations from the queue.
|
||||
CompanionPC = 30,
|
||||
Admin = 40, //
|
||||
ResourceUploader = 50, //Uploading dll and ai models
|
||||
ApiAdmin = 1000 //everything
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
|
||||
public class SecureAppConfig
|
||||
{
|
||||
public ApiConfig ApiConfig { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
|
||||
public class User
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Email { get; set; }
|
||||
public RoleEnum Role { get; set; }
|
||||
|
||||
public User(IEnumerable<Claim> claims)
|
||||
{
|
||||
var claimDict = claims.ToDictionary(x => x.Type, x => x.Value);
|
||||
|
||||
Id = Guid.Parse(claimDict[SecurityConstants.CLAIM_NAME_ID]);
|
||||
Email = claimDict[SecurityConstants.CLAIM_EMAIL];
|
||||
if (!Enum.TryParse(claimDict[SecurityConstants.CLAIM_ROLE], out RoleEnum role))
|
||||
role = RoleEnum.None;
|
||||
Role = role;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user