Add Master Data
This commit is contained in:
@@ -5,6 +5,7 @@ using AMREZ.EOP.Abstractions.Infrastructures.Common;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Abstractions.Security;
|
||||
using AMREZ.EOP.Contracts.DTOs.Authentications.Login;
|
||||
using AMREZ.EOP.Domain.Entities.Authentications;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.Authentications
|
||||
@@ -60,9 +61,15 @@ namespace AMREZ.EOP.Application.UseCases.Authentications
|
||||
return null;
|
||||
}
|
||||
|
||||
var roles = (user.UserRoles ?? Enumerable.Empty<UserRole>())
|
||||
.Where(ur => ur.Role != null /*&& ur.Role.TenantId == user.TenantId*/) // ถ้า Role เป็น per-tenant ค่อยกรอง
|
||||
.Select(ur => ur.Role!.Code)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToArray();
|
||||
|
||||
await _uow.CommitAsync(ct);
|
||||
|
||||
return new LoginResponse(user.Id, user.TenantId, email, tenantKey);
|
||||
return new LoginResponse(user.Id, user.TenantId, email, tenantKey, roles);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user