This commit is contained in:
@@ -347,15 +347,40 @@ namespace AyaNova.Api.Controllers
|
||||
log.LogInformation($"User \"{u.Name}\" logged in from \"{HttpContext.Connection.RemoteIpAddress.ToString()}\" ok");
|
||||
|
||||
|
||||
//return appropriate data
|
||||
|
||||
if (u.UserType == UserType.Customer | u.UserType == UserType.HeadOffice)
|
||||
{
|
||||
//customer type has special rights restrictions for UI features so return them here so client UI can enable or disable
|
||||
|
||||
|
||||
|
||||
return Ok(ApiOkResponse.Response(new
|
||||
{
|
||||
token = token,
|
||||
name = u.Name,
|
||||
usertype = u.UserType,
|
||||
roles = ((int)u.Roles).ToString(),
|
||||
dlt = DownloadToken,
|
||||
tfa = u.TwoFactorEnabled,
|
||||
CustomerAllowCSR = AyaNova.Util.ServerGlobalBizSettings.Cache.CustomerDefaultWorkOrderReportId,
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
token = token,
|
||||
name = u.Name,
|
||||
usertype = u.UserType,
|
||||
roles = ((int)u.Roles).ToString(),
|
||||
dlt = DownloadToken,
|
||||
tfa = u.TwoFactorEnabled
|
||||
}));
|
||||
//Non customer user
|
||||
return Ok(ApiOkResponse.Response(new
|
||||
{
|
||||
token = token,
|
||||
name = u.Name,
|
||||
usertype = u.UserType,
|
||||
roles = ((int)u.Roles).ToString(),
|
||||
dlt = DownloadToken,
|
||||
tfa = u.TwoFactorEnabled
|
||||
}));
|
||||
}
|
||||
|
||||
//------------------------ /STANDARD BLOCK -------------------------
|
||||
}
|
||||
@@ -664,7 +689,7 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
}
|
||||
|
||||
|
||||
|
||||
var u = await ct.User.FirstOrDefaultAsync(z => z.Id == id);
|
||||
if (u == null)//should never happen but ?
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
@@ -673,7 +698,7 @@ namespace AyaNova.Api.Controllers
|
||||
u.TempToken = null;
|
||||
u.TwoFactorEnabled = false;
|
||||
await ct.SaveChangesAsync();
|
||||
return NoContent();
|
||||
return NoContent();
|
||||
}
|
||||
//------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user