From bd72dada7648c34e0c4d2380d1df065cfa222f64 Mon Sep 17 00:00:00 2001 From: mahan Date: Sun, 21 Sep 2025 14:24:37 +0330 Subject: [PATCH] has ticket access --- .../Areas/Admin/Controllers/LoginController.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ServiceHost/Areas/Admin/Controllers/LoginController.cs b/ServiceHost/Areas/Admin/Controllers/LoginController.cs index 9c5b4a0c..e3855c55 100644 --- a/ServiceHost/Areas/Admin/Controllers/LoginController.cs +++ b/ServiceHost/Areas/Admin/Controllers/LoginController.cs @@ -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 Permissions, long? PositionValue,UserType UserType); +public record GetAdminProfileDetails(long Id, string Fullname, string Mobile, string RoleName, + List 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; } /// /// جزئیات پروفایل کاربر ادمین را برمی گرداند @@ -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; }