add userType to login data
This commit is contained in:
@@ -4,7 +4,7 @@ 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);
|
||||
public record GetAdminProfileDetails(long Id, string Fullname, string Mobile, string RoleName, List<int> Permissions, long? PositionValue,UserType UserType);
|
||||
|
||||
public class LoginController:AdminBaseController
|
||||
{
|
||||
@@ -32,7 +32,8 @@ public class LoginController:AdminBaseController
|
||||
return NotFound("کاربر یافت نشد");
|
||||
}
|
||||
|
||||
if (_authHelper.GetUserTypeWithId().userType is not UserType.Admin)
|
||||
var userTypeWithId = _authHelper.GetUserTypeWithId();
|
||||
if (userTypeWithId.userType is not UserType.Admin)
|
||||
return Unauthorized();
|
||||
|
||||
var details = new GetAdminProfileDetails(
|
||||
@@ -41,7 +42,8 @@ public class LoginController:AdminBaseController
|
||||
data.Mobile,
|
||||
data.RoleName,
|
||||
data.Permissions,
|
||||
data.PositionValue
|
||||
data.PositionValue,
|
||||
userTypeWithId.userType
|
||||
);
|
||||
return details;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public record GetClientProfileDetails(long Id, string Fullname, string Mobile, List<int> Permissions, List<WorkshopClaim> Workshops, string WorkshopSlug, double DebtAmount);
|
||||
public record GetClientProfileDetails(long Id, string Fullname, string Mobile, List<int> Permissions, List<WorkshopClaim> Workshops, string WorkshopSlug, double DebtAmount,UserType UserType);
|
||||
|
||||
public class LoginController : ClientBaseController
|
||||
{
|
||||
@@ -32,7 +32,8 @@ public class LoginController : ClientBaseController
|
||||
if (data == null)
|
||||
return Unauthorized();
|
||||
|
||||
if (_authHelper.GetUserTypeWithId().userType is not UserType.Client and not UserType.SubAccount)
|
||||
var userTypeWithId = _authHelper.GetUserTypeWithId();
|
||||
if (userTypeWithId.userType is not UserType.Client and not UserType.SubAccount)
|
||||
return Unauthorized();
|
||||
|
||||
var debtAmount = await _financialStatmentApplication.GetClientDebtAmount(data.Id);
|
||||
@@ -43,7 +44,8 @@ public class LoginController : ClientBaseController
|
||||
data.Permissions,
|
||||
data.WorkshopList,
|
||||
data.WorkshopSlug,
|
||||
debtAmount
|
||||
debtAmount,
|
||||
userTypeWithId.userType
|
||||
);
|
||||
return details;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user