Compare commits
10 Commits
1c53b284f2
...
573d022979
Author | SHA1 | Date | |
---|---|---|---|
![]() |
573d022979 | ||
![]() |
dc6fa270f6 | ||
99b7150194 | |||
ced44e982d | |||
f1fe950f50 | |||
![]() |
8e6425fc54 | ||
![]() |
2301af19cb | ||
![]() |
6fd5147409 | ||
![]() |
29596169d0 | ||
![]() |
60d57b4ee7 |
@ -127,7 +127,7 @@ namespace ApiGateway
|
||||
foreach (Claim cl in claims) // Claim (key:value) desde el token
|
||||
{
|
||||
|
||||
if (cl.Type == claim.Key && String.Equals(claim.Key, "permisos"))
|
||||
if (cl.Type == claim.Key && String.Equals(claim.Key, "prm"))
|
||||
{
|
||||
string separador = "::";
|
||||
|
||||
|
@ -22,10 +22,11 @@ namespace Security
|
||||
}
|
||||
else
|
||||
{
|
||||
string DevKey = Environment.GetEnvironmentVariable("MySecretKey")!;
|
||||
ReadCredentials();
|
||||
/*string DevKey = Environment.GetEnvironmentVariable("MySecretKey")!;
|
||||
HashKey = DevKey;
|
||||
PwdKey = DevKey;
|
||||
_SEMILLA = 1262;
|
||||
_SEMILLA = 1262;*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +50,7 @@ namespace Security
|
||||
|
||||
//var folder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
|
||||
var filePath = Path.Combine("C:\\Users\\Administrator", ".hims", "info");
|
||||
var filePath = Path.Combine("Z:\\Users\\Administrator", ".hims", "info");
|
||||
//var filePath = Path.Combine("C:\\Users\\Admin\\Desktop\\sqsas\\usuarios", "info");
|
||||
|
||||
//Validacion manual antes de leer
|
||||
|
@ -15,6 +15,7 @@ namespace MSAdminUsuarios.Context
|
||||
public string? TX_NOMBRE_PVD { get; set; }
|
||||
public string? TX_CORREO_USUMS { get; set; }
|
||||
public string? TX_TELEFONO_USUMS { get; set; }
|
||||
public string? TX_DIRECCION_USUMS { get; set; }
|
||||
public int? NU_ESTADO_USUMS { get; set; }
|
||||
public DateTime? FE_INICIOACTIVACION_USUTMP { get; set; }
|
||||
public DateTime? FE_FINACTIVACION_USUTMP { get; set; }
|
||||
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using MSAdminUsuarios.Context;
|
||||
using MSAdminUsuarios.Dto;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Security;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
@ -68,10 +69,12 @@ namespace MSAdminUsuarios.Controllers
|
||||
);
|
||||
|
||||
if (loggedWithLdap == true) {
|
||||
string token = Token(userldap);
|
||||
//string token = Token(userldap);
|
||||
AutorizaDTO autorizado = Token(userldap);
|
||||
return Ok(new
|
||||
{
|
||||
token = token,
|
||||
//token = autorizado.token,
|
||||
token = autorizado,
|
||||
user = userldap.TX_PKDOC_USUMS,
|
||||
ldap = 1
|
||||
});
|
||||
@ -80,7 +83,7 @@ namespace MSAdminUsuarios.Controllers
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
}else if(userldap.BL_VIENELDAP_USUMS != 1) //return BadRequest(new ResLoginExt("No eres un usuario interno.", true, userldap.NU_ESTADO_USUMS));
|
||||
} else if (userldap.BL_VIENELDAP_USUMS != 1) //return BadRequest(new ResLoginExt("No eres un usuario interno.", true, userldap.NU_ESTADO_USUMS));
|
||||
{
|
||||
/*USUARIO? user = _context.USUARIOSMs.FirstOrDefault(u => u.TX_LOGINNAME_USUMS == login.TX_LOGINNAME_USUMS && u.TX_PASSWORD_USUMS == _encript.EncryptPwd(login.TX_PASSWORD_USUMS));
|
||||
if (user == null) return BadRequest("Usuario o contraseña incorrectos");*/
|
||||
@ -97,17 +100,17 @@ namespace MSAdminUsuarios.Controllers
|
||||
primera = user.NU_INICIO_PRIMERAVEZ_USUMS,
|
||||
ldap = 0
|
||||
});*/
|
||||
}else
|
||||
} else
|
||||
{
|
||||
return BadRequest("Error");
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e)
|
||||
{
|
||||
return BadRequest(e.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*[HttpPost("CambiarClave_old")]
|
||||
@ -138,18 +141,23 @@ namespace MSAdminUsuarios.Controllers
|
||||
try
|
||||
{
|
||||
if (!_encript.IsValid) return BadRequest(new ResLoginExt("Lectura inv<6E>lida"));
|
||||
//if (!_encript.IsValid) return BadRequest("Lectura inv<6E>lida");
|
||||
|
||||
if (login.TX_LOGINNAME_USUMS == null) return BadRequest(new ResLoginExt("Es necesario ingresar un usuario"));
|
||||
//if (login.TX_LOGINNAME_USUMS == null) return BadRequest("Es necesario ingresar un usuario");
|
||||
if (login.TX_PASSWORD_USUMS == null) return BadRequest(new ResLoginExt("Es necesario ingresar una contrase<73>a"));
|
||||
//if (login.TX_PASSWORD_USUMS == null) return BadRequest("Es necesario ingresar una contrase<73>a");
|
||||
|
||||
USUARIO? userExist = _context.USUARIOSMs.FirstOrDefault(u => u.TX_LOGINNAME_USUMS == login.TX_LOGINNAME_USUMS);
|
||||
if (userExist == null) return BadRequest(new ResLoginExt("Usuario o contrase<73>a incorrectos"));
|
||||
//if (userExist == null) return BadRequest("Usuario o contrase<73>a incorrectos");
|
||||
|
||||
USUARIO? user = _context.USUARIOSMs.FirstOrDefault(u => u.TX_LOGINNAME_USUMS == login.TX_LOGINNAME_USUMS && u.TX_PASSWORD_USUMS == _encript.EncryptPwd(login.TX_PASSWORD_USUMS));
|
||||
if (user == null) return BadRequest(new ResLoginExt("Usuario o contraseña incorrectos", true, userExist.NU_ESTADO_USUMS));
|
||||
|
||||
//if (user.NU_ESTADO_USUMS == null) return BadRequest(new ResLoginExt("Usuario eliminado.", true, user.NU_ESTADO_USUMS));
|
||||
if (user.NU_ESTADO_USUMS == 0) return BadRequest(new ResLoginExt("Usuario inactivo.", true, user.NU_ESTADO_USUMS));
|
||||
//if (user.NU_ESTADO_USUMS == 0) return BadRequest("Usuario inactivo.");
|
||||
if (user.NU_ESTADO_USUMS == 2) return BadRequest(new ResLoginExt("Usuario bloqueado.", true, user.NU_ESTADO_USUMS));
|
||||
|
||||
if (user.BL_VIENELDAP_USUMS != 0) return BadRequest(new ResLoginExt("No eres un usuario externo.", true, user.NU_ESTADO_USUMS));
|
||||
@ -208,12 +216,13 @@ namespace MSAdminUsuarios.Controllers
|
||||
//{
|
||||
|
||||
//}
|
||||
string token = Token(user);
|
||||
//string token = Token(user);
|
||||
AutorizaDTO autorizado = Token(user);
|
||||
user.FE_RECUPERACLAVE = null;
|
||||
_context.USUARIOSMs.Update(user);
|
||||
_context.SaveChanges();
|
||||
|
||||
return Ok(new ResLoginExt("Bienvenido al sistema.", true, user.NU_ESTADO_USUMS, token, user.NU_INICIO_PRIMERAVEZ_USUMS, user.TX_PKDOC_USUMS, user.BL_VIENELDAP_USUMS));
|
||||
return Ok(new ResLoginExt("Bienvenido al sistema.", true, user.NU_ESTADO_USUMS, autorizado, user.NU_INICIO_PRIMERAVEZ_USUMS, user.TX_PKDOC_USUMS, user.BL_VIENELDAP_USUMS));
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -247,6 +256,7 @@ namespace MSAdminUsuarios.Controllers
|
||||
_context.USUARIOSMs.Update(userExist);
|
||||
_context.SaveChanges();
|
||||
|
||||
//return Ok(new RecuperarClaveModel("Se enviará un correo para continuar el proceso.", true, userExist.NU_ESTADO_USUMS, userExist.TX_CORREO_USUMS, RecuperaIdGenerada));
|
||||
return Ok(new RecuperarClaveModel("Se enviará un correo para continuar el proceso.", true, userExist.NU_ESTADO_USUMS, userExist.TX_CORREO_USUMS, RecuperaIdGenerada));
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -270,8 +280,9 @@ namespace MSAdminUsuarios.Controllers
|
||||
|
||||
if (user == null) return BadRequest("No se encuentra usuario");
|
||||
|
||||
string newToken = Token(user);
|
||||
return Ok(newToken);
|
||||
//string newToken = Token(user);
|
||||
AutorizaDTO autorizado = Token(user);
|
||||
return Ok(autorizado.token);
|
||||
|
||||
} catch(Exception ex)
|
||||
{
|
||||
@ -311,13 +322,14 @@ namespace MSAdminUsuarios.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
// **** Original
|
||||
[HttpPost("pruebaUsuario")]
|
||||
public string Token(USUARIO user)
|
||||
public AutorizaDTO Token(USUARIO user)
|
||||
{
|
||||
List<PERFILPORUSUARIO> perfilesPorUsuario = (from perf in _context.PERFILESPORUSUARIOs
|
||||
where perf.TX_FKDOC_USUMS == user.TX_PKDOC_USUMS && perf.NU_FK_PFL != null && perf.BL_ESTADO_PFLXUSU == 1
|
||||
select perf).ToList();
|
||||
|
||||
|
||||
_logger.LogInformation(perfilesPorUsuario.ToString());
|
||||
|
||||
List<int?> perfiles = perfilesPorUsuario.Select(p => p.NU_FK_PFL).ToList();
|
||||
@ -336,8 +348,14 @@ namespace MSAdminUsuarios.Controllers
|
||||
if (perfilesPorPermiso.ContainsKey(key))
|
||||
{
|
||||
string antVal = perfilesPorPermiso[key];
|
||||
perfilesPorPermiso.Remove(key);
|
||||
perfilesPorPermiso.Add(key, antVal + "," + val);
|
||||
/*perfilesPorPermiso.Remove(key);
|
||||
perfilesPorPermiso.Add(key, antVal + "," + val);*/
|
||||
List<string> result = new List<string>(antVal.Split(','));
|
||||
if (!result.Contains(val))
|
||||
{
|
||||
perfilesPorPermiso.Remove(key);
|
||||
perfilesPorPermiso.Add(key, antVal + "|" + val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -390,12 +408,15 @@ namespace MSAdminUsuarios.Controllers
|
||||
// claims.AddClaim(new Claim("permisos", Encripter.Encrypt(p.NU_FK_MS.ToString())));
|
||||
//}
|
||||
|
||||
List<string> permisosCifrados = new List<string>();
|
||||
foreach (KeyValuePair<string, string> p in perfilesPorPermiso)
|
||||
{
|
||||
string key = p.Key;
|
||||
string val = p.Value;
|
||||
|
||||
claims.AddClaim(new Claim("permisos", _encript.EncryptHashTkn(key) + "::" + val));
|
||||
//claims.AddClaim(new Claim("permisos", _encript.EncryptHashTkn(key) + "::" + val));
|
||||
//permisosCifrados.Add(_encript.EncryptHashTkn(key) + "::" + val);
|
||||
permisosCifrados.Add(key + "::" + "[" + val + "]");
|
||||
}
|
||||
|
||||
var securityTokenDescriptor = new SecurityTokenDescriptor
|
||||
@ -409,8 +430,219 @@ namespace MSAdminUsuarios.Controllers
|
||||
var securityToken = jwtSecurityTokenHandler.CreateToken(securityTokenDescriptor);
|
||||
var token = jwtSecurityTokenHandler.WriteToken(securityToken);
|
||||
|
||||
return Encripter.Cypher(token);
|
||||
AutorizaDTO autorizaDTO = new AutorizaDTO();
|
||||
autorizaDTO.token = Encripter.Cypher(token);
|
||||
autorizaDTO.permisos = permisosCifrados;
|
||||
|
||||
//return Encripter.Cypher(token);
|
||||
return autorizaDTO;
|
||||
}
|
||||
// **** Original **
|
||||
|
||||
//[HttpPost("pruebaUsuario")]
|
||||
//public string Token(USUARIO user)
|
||||
//{
|
||||
// List<PERFILPORUSUARIO> perfilesPorUsuario = (from perf in _context.PERFILESPORUSUARIOs
|
||||
// where perf.TX_FKDOC_USUMS == user.TX_PKDOC_USUMS && perf.NU_FK_PFL != null && perf.BL_ESTADO_PFLXUSU == 1
|
||||
// select perf).ToList();
|
||||
|
||||
// _logger.LogInformation(perfilesPorUsuario.ToString());
|
||||
|
||||
// List<int?> perfiles = perfilesPorUsuario.Select(p => p.NU_FK_PFL).ToList();
|
||||
|
||||
// // Verificar si alguno de los perfiles es 2
|
||||
// bool perfilEsDos = perfiles.Contains(2);
|
||||
|
||||
// // Solo obtenemos permisos si no existe el perfil 2
|
||||
// List<PERMISO> permisos = perfilEsDos ? new List<PERMISO>() :
|
||||
// (from perfXUs in perfilesPorUsuario
|
||||
// join perm in _context.PERMISOSMs on perfXUs.NU_FK_PFL equals perm.NU_FK_PFL
|
||||
// where perm.BL_ESTADO_PMS == 1
|
||||
// select perm).ToList();
|
||||
|
||||
// Dictionary<string, string> perfilesPorPermiso = new();
|
||||
// // Todos
|
||||
// if (!perfilEsDos) // Solo procesar permisos si el perfil no es 2
|
||||
// {
|
||||
// foreach (PERMISO p in permisos)
|
||||
// {
|
||||
// string key = p.NU_FK_MS.ToString();
|
||||
// string val = p.NU_FK_PFL.ToString();
|
||||
|
||||
// if (perfilesPorPermiso.ContainsKey(key))
|
||||
// {
|
||||
// string antVal = perfilesPorPermiso[key];
|
||||
// perfilesPorPermiso[key] = antVal + "," + val;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// perfilesPorPermiso.Add(key, val);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// perfiles.Add(-1);
|
||||
|
||||
// // Security key debe ser un environment variable seguro
|
||||
// var secretKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Encripter.HashKey));
|
||||
// var signingCredentials = new SigningCredentials(secretKey, SecurityAlgorithms.HmacSha256);
|
||||
// string nombres = "";
|
||||
// string apellidos = "";
|
||||
|
||||
// if (user.TX_PRIMERNOM_USUMS != null) nombres += user.TX_PRIMERNOM_USUMS;
|
||||
// if (user.TX_SEGUNDONOM_USUMS != null) nombres += " " + user.TX_SEGUNDONOM_USUMS;
|
||||
// if (user.TX_PRIMERAPELL_USUMS != null) apellidos += user.TX_PRIMERAPELL_USUMS;
|
||||
// if (user.TX_SEGUNDOAPELL_USUMS != null) apellidos += " " + user.TX_SEGUNDOAPELL_USUMS;
|
||||
|
||||
// nombres = nombres.Trim();
|
||||
// apellidos = apellidos.Trim();
|
||||
|
||||
// if (nombres == "") nombres = "N";
|
||||
// if (apellidos == "") apellidos = "A";
|
||||
|
||||
// int tipo_doc = user.NU_TIPODOC_USUMS == null ? -1 : (int)user.NU_TIPODOC_USUMS;
|
||||
|
||||
// ClaimsIdentity claims = new ClaimsIdentity(new List<Claim>
|
||||
//{
|
||||
// new Claim("user", user.TX_PKDOC_USUMS),
|
||||
// new Claim("nombres", nombres),
|
||||
// new Claim("apellidos", apellidos),
|
||||
// new Claim("tipo_doc", tipo_doc.ToString()),
|
||||
// new Claim("pk", user.NU_PK_USUMS.ToString()),
|
||||
// new Claim("sedes", user.TX_SEDES_USUMS ?? ""),
|
||||
// new Claim("TX_NOMBRE_PVD", user.TX_NOMBRE_PVD ?? "{}"),
|
||||
// new Claim("uid", user.TX_UUID_USUMS.ToString())
|
||||
//});
|
||||
|
||||
// foreach (int p in perfiles)
|
||||
// {
|
||||
// claims.AddClaim(new Claim("perfiles", p.ToString(), ClaimValueTypes.String));
|
||||
// }
|
||||
|
||||
// if (!perfilEsDos) // Añadir permisos solo si perfil no es 2
|
||||
// {
|
||||
// foreach (KeyValuePair<string, string> p in perfilesPorPermiso)
|
||||
// {
|
||||
// string key = p.Key;
|
||||
// string val = p.Value;
|
||||
// claims.AddClaim(new Claim("permisos", _encript.EncryptHashTkn(key) + "::" + val));
|
||||
// }
|
||||
// }
|
||||
|
||||
// var securityTokenDescriptor = new SecurityTokenDescriptor
|
||||
// {
|
||||
// Subject = claims,
|
||||
// Expires = DateTime.Now.AddDays(20),
|
||||
// SigningCredentials = signingCredentials
|
||||
// };
|
||||
|
||||
// var jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
|
||||
// var securityToken = jwtSecurityTokenHandler.CreateToken(securityTokenDescriptor);
|
||||
// var token = jwtSecurityTokenHandler.WriteToken(securityToken);
|
||||
|
||||
// return Encripter.Cypher(token);
|
||||
//}
|
||||
|
||||
//[HttpPost("pruebaUsuario")]
|
||||
//public string Token(USUARIO user)
|
||||
//{
|
||||
// List<PERFILPORUSUARIO> perfilesPorUsuario = (from perf in _context.PERFILESPORUSUARIOs
|
||||
// where perf.TX_FKDOC_USUMS == user.TX_PKDOC_USUMS && perf.NU_FK_PFL != null && perf.BL_ESTADO_PFLXUSU == 1
|
||||
// select perf).ToList();
|
||||
|
||||
// _logger.LogInformation(perfilesPorUsuario.ToString());
|
||||
|
||||
// List<int?> perfiles = perfilesPorUsuario.Select(p => p.NU_FK_PFL).ToList();
|
||||
|
||||
// List<PERMISO> permisos = (from perfXUs in perfilesPorUsuario
|
||||
// join perm in _context.PERMISOSMs on perfXUs.NU_FK_PFL equals perm.NU_FK_PFL
|
||||
// where perm.BL_ESTADO_PMS == 1
|
||||
// select perm).ToList();
|
||||
|
||||
// Dictionary<string, string> perfilesPorPermiso = new();
|
||||
// foreach (PERMISO p in permisos)
|
||||
// {
|
||||
// string key = p.NU_FK_MS.ToString();
|
||||
// string val = p.NU_FK_PFL.ToString();
|
||||
|
||||
// if (perfilesPorPermiso.ContainsKey(key))
|
||||
// {
|
||||
// string antVal = perfilesPorPermiso[key];
|
||||
// perfilesPorPermiso.Remove(key);
|
||||
// perfilesPorPermiso.Add(key, antVal + "," + val);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// perfilesPorPermiso.Add(key, val);
|
||||
// }
|
||||
// }
|
||||
|
||||
// perfiles.Add(-1);
|
||||
|
||||
// //Security key debe ser un environment variable seguro
|
||||
// var secretKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Encripter.HashKey));
|
||||
// var signingCredentials = new SigningCredentials(secretKey, SecurityAlgorithms.HmacSha256);
|
||||
// string nombres = "";
|
||||
// string apellidos = "";
|
||||
|
||||
// if (user.TX_PRIMERNOM_USUMS != null) nombres += user.TX_PRIMERNOM_USUMS;
|
||||
// if (user.TX_SEGUNDONOM_USUMS != null) nombres += " " + user.TX_SEGUNDONOM_USUMS;
|
||||
// if (user.TX_PRIMERAPELL_USUMS != null) apellidos += user.TX_PRIMERAPELL_USUMS;
|
||||
// if (user.TX_SEGUNDOAPELL_USUMS != null) apellidos += " " + user.TX_SEGUNDOAPELL_USUMS;
|
||||
|
||||
// nombres = nombres.Trim();
|
||||
// apellidos = apellidos.Trim();
|
||||
|
||||
// if (nombres == "") nombres = "N";
|
||||
// if (apellidos == "") apellidos = "A";
|
||||
|
||||
// int tipo_doc = user.NU_TIPODOC_USUMS == null ? -1 : (int)user.NU_TIPODOC_USUMS;
|
||||
|
||||
// ClaimsIdentity claims = new ClaimsIdentity(new List<Claim>
|
||||
// {
|
||||
// new Claim("us", user.TX_PKDOC_USUMS),
|
||||
// new Claim("nm", nombres),
|
||||
// new Claim("ap", apellidos),
|
||||
// new Claim("td", tipo_doc.ToString()),
|
||||
// new Claim("pk", user.NU_PK_USUMS.ToString()),
|
||||
// new Claim("s", user.TX_SEDES_USUMS == null ? "" : user.TX_SEDES_USUMS),
|
||||
// new Claim("PVD", user.TX_NOMBRE_PVD ?? "{}"),
|
||||
// new Claim("uid", user.TX_UUID_USUMS.ToString())
|
||||
// });
|
||||
|
||||
|
||||
// foreach (int p in perfiles)
|
||||
// {
|
||||
// claims.AddClaim(new Claim("perfiles", p.ToString(), ClaimValueTypes.String));
|
||||
// }
|
||||
|
||||
|
||||
// //foreach (PERMISO p in permisos)
|
||||
// //{
|
||||
// // claims.AddClaim(new Claim("permisos", Encripter.Encrypt(p.NU_FK_MS.ToString())));
|
||||
// //}
|
||||
|
||||
// foreach (KeyValuePair<string, string> p in perfilesPorPermiso)
|
||||
// {
|
||||
// string key = p.Key;
|
||||
// string val = p.Value;
|
||||
|
||||
// claims.AddClaim(new Claim("prm", _encript.EncryptHashTkn(key) + "|" + val));
|
||||
// }
|
||||
|
||||
// var securityTokenDescriptor = new SecurityTokenDescriptor
|
||||
// {
|
||||
// Subject = claims,
|
||||
// Expires = DateTime.Now.AddDays(20),
|
||||
// SigningCredentials = signingCredentials
|
||||
// };
|
||||
|
||||
// var jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
|
||||
// var securityToken = jwtSecurityTokenHandler.CreateToken(securityTokenDescriptor);
|
||||
// var token = jwtSecurityTokenHandler.WriteToken(securityToken);
|
||||
|
||||
// return Encripter.Cypher(token);
|
||||
//}
|
||||
|
||||
[HttpPatch("BloquearUsuario")]
|
||||
public IActionResult BloquearUsuario([FromBody] string usuario)
|
||||
@ -542,7 +774,9 @@ namespace MSAdminUsuarios.Controllers
|
||||
public class ResLoginExt
|
||||
{
|
||||
|
||||
public ResLoginExt(string _message, bool _exist = false, int? _estado = null, string? _token = "", int? _primera = null, string? _user = "", int? _ldap = null)
|
||||
//public ResLoginExt(string _message, bool _exist = false, int? _estado = null, string? _token = "", int? _primera = null, string? _user = "", int? _ldap = null)
|
||||
public ResLoginExt(string _message, bool _exist = false, int? _estado = null, AutorizaDTO? _token = null, int? _primera = null, string? _user = "", int? _ldap = null)
|
||||
|
||||
{
|
||||
Message = _message;
|
||||
Token = _token;
|
||||
@ -555,8 +789,9 @@ namespace MSAdminUsuarios.Controllers
|
||||
}
|
||||
|
||||
public bool Existe { get; set; }
|
||||
public int? Estado { get; set; }
|
||||
public string? Token { get; set; }
|
||||
public int? Estado { get; set; }
|
||||
//public string? Token { get; set; }
|
||||
public AutorizaDTO? Token { get; set; }
|
||||
public string Message { get; set; } = null!;
|
||||
public int? Primera { get; set; }
|
||||
public string? User { get; set; }
|
||||
|
@ -22,7 +22,9 @@ namespace MSAdminUsuarios.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
List<PERFIL> consulta = await _context.PERFILESMs.OrderBy(p => p.NU_PK_PFL).Where(p=>p.BL_ESTADO_PFL > 0).ToListAsync();
|
||||
//List<PERFIL> consulta = await _context.PERFILESMs.OrderBy(p => p.NU_PK_PFL).Where(p=>p.BL_ESTADO_PFL > 0).ToListAsync();
|
||||
|
||||
List<PERFIL> consulta = await _context.PERFILESMs.OrderBy(p => p.NU_PK_PFL).Where(p => p.BL_ESTADO_PFL >= 0).ToListAsync();
|
||||
|
||||
//var consulta = from dm in _context.PERFILESMs
|
||||
// where dm.BL_ESTADO_PFL>=0
|
||||
|
@ -274,7 +274,7 @@ namespace MSAdminUsuarios.Controllers
|
||||
else if (existeDoc.NU_ESTADO_USUMS == 2)
|
||||
{
|
||||
_errorModel.error = true;
|
||||
_errorModel.cuerpo.Add("Ya existe un usuario activo con ese número de documento.");
|
||||
_errorModel.cuerpo.Add("Ya existe un usuario activo bloqueado con ese número de documento.");
|
||||
return Conflict(_errorModel);
|
||||
}
|
||||
}
|
||||
|
8
Microservicios/MsUsuarios/Dto/AutorizaDTO.cs
Normal file
8
Microservicios/MsUsuarios/Dto/AutorizaDTO.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace MSAdminUsuarios.Dto
|
||||
{
|
||||
public class AutorizaDTO
|
||||
{
|
||||
public string token { get; set; } = "";
|
||||
public List<string> permisos { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
//"sslPort": 7292,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"ConString": "user id=ADMIN;password=AFQ_2024;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=181.204.191.98)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PROYECTOS)))"
|
||||
"ConString": "user id=ADMIN;password=AFQ_2024;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=162.215.134.149)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PROYECTOS)))"
|
||||
},
|
||||
"RabbitMQConfig": {
|
||||
"HostName": "localhost",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"ConString": "user id=ADMIN;password=AFQ_2024;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.194)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PROYECTOS)))"
|
||||
"ConString": "user id=ADMIN;password=AFQ_2024;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=162.215.134.149)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=PROYECTOS)))"
|
||||
},
|
||||
"RabbitMQConfig": {
|
||||
"HostName": "localhost",
|
||||
|
Loading…
Reference in New Issue
Block a user