has ticket access

This commit is contained in:
2025-09-21 14:24:37 +03:30
parent e79dabbb2d
commit bd72dada76

View File

@@ -1,20 +1,23 @@
using _0_Framework.Application;
using AccountManagement.Application.Contracts.TicketAccessAccount;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
using ServiceHost.Controllers;
namespace ServiceHost.Areas.Admin.Controllers;
public record GetAdminProfileDetails(long Id, string Fullname, string Mobile, string RoleName, List<int> Permissions, long? PositionValue,UserType UserType);
public record GetAdminProfileDetails(long Id, string Fullname, string Mobile, string RoleName,
List<int> Permissions, long? PositionValue,UserType UserType,bool HasTicketAccess);
public class LoginController:AdminBaseController
{
private readonly IAuthHelper _authHelper;
public LoginController(IAuthHelper authHelper)
private readonly ITicketAccessAccountApplication _ticketAccessAccount;
public LoginController(IAuthHelper authHelper, ITicketAccessAccountApplication ticketAccessAccount)
{
_authHelper = authHelper;
_ticketAccessAccount = ticketAccessAccount;
}
/// <summary>
/// جزئیات پروفایل کاربر ادمین را برمی گرداند
@@ -36,6 +39,8 @@ public class LoginController:AdminBaseController
if (userTypeWithId.userType is not UserType.Admin)
return Unauthorized();
var hasTicketAccess = _ticketAccessAccount.HasTicketAccess(data.Id);
var details = new GetAdminProfileDetails(
data.Id,
data.Fullname,
@@ -43,7 +48,8 @@ public class LoginController:AdminBaseController
data.RoleName,
data.Permissions,
data.PositionValue,
userTypeWithId.userType
userTypeWithId.userType,
hasTicketAccess
);
return details;
}