Merge branch 'master' of http://181.129.245.90:81/Bonobo.Git.Server/Apigateway
This commit is contained in:
commit
a9040539b8
1
.gitignore
vendored
1
.gitignore
vendored
@ -35,6 +35,7 @@ bld/
|
|||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
|
.vscode/
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
#wwwroot/
|
#wwwroot/
|
||||||
|
|
||||||
|
20
Microservicios/MsUsuarios/Context/CORREOSAREAMS.cs
Normal file
20
Microservicios/MsUsuarios/Context/CORREOSAREAMS.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
namespace MSAdminUsuarios.Context
|
||||||
|
{
|
||||||
|
public class CORREOSAREAMS
|
||||||
|
{
|
||||||
|
/*public int NU_PK_CORA { get; set; }
|
||||||
|
public int? NU_MODULO_CORA { get; set; }
|
||||||
|
public int? NU_AREA_CORA { get; set; }
|
||||||
|
public int? NU_SEDE_CORA { get; set; }
|
||||||
|
public int? BL_ESTADO_CORA { get; set; }
|
||||||
|
public string? TX_FKDOC_USUMS { get; set; }
|
||||||
|
public string? TX_CORREOS_CORA { get; set; }*/
|
||||||
|
public int NU_PK_CRRMS { get; set; }
|
||||||
|
public string? TX_AREA_CRRMS { get; set; }
|
||||||
|
public int? NU_FK_MS { get; set; }
|
||||||
|
public string? TX_FKDOC_USUMS { get; set; }
|
||||||
|
public string? TX_SEDES_CRRMS { get; set; }
|
||||||
|
public string? TX_CORREOS_CRRMS { get; set; }
|
||||||
|
public int? NU_ESTADO_CRRMS { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
namespace MSAdminUsuarios.Context
|
|
||||||
{
|
|
||||||
public class CorreosArea
|
|
||||||
{
|
|
||||||
public int NU_PK_CORA { get; set; }
|
|
||||||
public int? NU_MODULO_CORA { get; set; }
|
|
||||||
public int? NU_AREA_CORA { get; set; }
|
|
||||||
public int? NU_SEDE_CORA { get; set; }
|
|
||||||
public int? BL_ESTADO_CORA { get; set; }
|
|
||||||
public string? TX_FKDOC_USUMS { get; set; }
|
|
||||||
public string? TX_CORREOS_CORA { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -22,7 +22,7 @@ namespace MSAdminUsuarios.Context
|
|||||||
public virtual DbSet<PERFIL> PERFILESMs { get; set; } = null!;
|
public virtual DbSet<PERFIL> PERFILESMs { get; set; } = null!;
|
||||||
public virtual DbSet<PERFILPORUSUARIO> PERFILESPORUSUARIOs { get; set; } = null!;
|
public virtual DbSet<PERFILPORUSUARIO> PERFILESPORUSUARIOs { get; set; } = null!;
|
||||||
public virtual DbSet<USUARIO> USUARIOSMs { get; set; } = null!;
|
public virtual DbSet<USUARIO> USUARIOSMs { get; set; } = null!;
|
||||||
public virtual DbSet<CorreosArea> CORREOSAREAMS { get; set; } = null!;
|
public virtual DbSet<CORREOSAREAMS> CORREOSAREAMS { get; set; } = null!;
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
@ -97,9 +97,9 @@ namespace MSAdminUsuarios.Context
|
|||||||
entity.Property(e => e.CL_FIRMA_USUMS).HasColumnType("CLOB");
|
entity.Property(e => e.CL_FIRMA_USUMS).HasColumnType("CLOB");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<CorreosArea>(entity =>
|
modelBuilder.Entity<CORREOSAREAMS>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.NU_PK_CORA);
|
entity.HasKey(e => e.NU_PK_CRRMS);
|
||||||
|
|
||||||
entity.ToTable("CORREOSAREAMS");
|
entity.ToTable("CORREOSAREAMS");
|
||||||
|
|
||||||
|
@ -29,6 +29,6 @@ namespace MSAdminUsuarios.Context
|
|||||||
public int? NU_CARGO_USUMS { get; set; }
|
public int? NU_CARGO_USUMS { get; set; }
|
||||||
public int? NU_MODALIDADCTT_USUMS { get; set; }
|
public int? NU_MODALIDADCTT_USUMS { get; set; }
|
||||||
public string? TX_SEDES_USUMS { get; set; }
|
public string? TX_SEDES_USUMS { get; set; }
|
||||||
|
public int? NU_BLOQUEO_USUMS { get; set; } = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,14 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!_encript.IsValid) return BadRequest("Lectura inválida");
|
if (!_encript.IsValid) return BadRequest("Lectura inv<EFBFBD>lida");
|
||||||
|
|
||||||
if (login.TX_LOGINNAME_USUMS == null) return BadRequest("Es necesario ingresar un correo");
|
if (login.TX_LOGINNAME_USUMS == null) return BadRequest("Es necesario ingresar un correo");
|
||||||
if (login.TX_PASSWORD_USUMS == null) return BadRequest("Es necesario ingresar una contraseña");
|
if (login.TX_PASSWORD_USUMS == null) return BadRequest("Es necesario ingresar una contrase<EFBFBD>a");
|
||||||
|
|
||||||
USUARIO? user = _context.USUARIOSMs.FirstOrDefault(u => u.TX_LOGINNAME_USUMS == login.TX_LOGINNAME_USUMS && u.TX_PASSWORD_USUMS == _encript.EncryptPwd(login.TX_PASSWORD_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");
|
if (user == null) return BadRequest("Usuario o contrase<EFBFBD>a incorrectos");
|
||||||
|
|
||||||
string token = Token(user);
|
string token = Token(user);
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
_context.USUARIOSMs.Update(user);
|
_context.USUARIOSMs.Update(user);
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
|
|
||||||
return Ok("Contraseña actualizada correctamente");
|
return Ok("Contrase<EFBFBD>a actualizada correctamente");
|
||||||
} catch (Exception e)
|
} catch (Exception e)
|
||||||
{
|
{
|
||||||
return Conflict(e.Message);
|
return Conflict(e.Message);
|
||||||
@ -74,17 +74,17 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!_encript.IsValid) return BadRequest(new ResLoginExt("Lectura inválida"));
|
if (!_encript.IsValid) return BadRequest(new ResLoginExt("Lectura inv<EFBFBD>lida"));
|
||||||
|
|
||||||
if (login.TX_LOGINNAME_USUMS == null) return BadRequest(new ResLoginExt("Es necesario ingresar un usuario"));
|
if (login.TX_LOGINNAME_USUMS == null) return BadRequest(new ResLoginExt("Es necesario ingresar un usuario"));
|
||||||
if (login.TX_PASSWORD_USUMS == null) return BadRequest(new ResLoginExt("Es necesario ingresar una contraseña"));
|
if (login.TX_PASSWORD_USUMS == null) return BadRequest(new ResLoginExt("Es necesario ingresar una contrase<EFBFBD>a"));
|
||||||
|
|
||||||
USUARIO? userExist = _context.USUARIOSMs.FirstOrDefault(u => u.TX_LOGINNAME_USUMS == login.TX_LOGINNAME_USUMS);
|
USUARIO? userExist = _context.USUARIOSMs.FirstOrDefault(u => u.TX_LOGINNAME_USUMS == login.TX_LOGINNAME_USUMS);
|
||||||
if (userExist == null) return BadRequest(new ResLoginExt("Usuario o contraseña incorrectos"));
|
if (userExist == null) return BadRequest(new ResLoginExt("Usuario o contrase<EFBFBD>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));
|
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 == null) return BadRequest(new ResLoginExt("Usuario o contrase<EFBFBD>a incorrectos", true, userExist.NU_ESTADO_USUMS));
|
||||||
|
|
||||||
if (user.NU_ESTADO_USUMS != 1) return BadRequest(new ResLoginExt("Usuario inactivo o eliminado.", true, user.NU_ESTADO_USUMS));
|
if (user.NU_ESTADO_USUMS != 1) return BadRequest(new ResLoginExt("Usuario inactivo o eliminado.", true, user.NU_ESTADO_USUMS));
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
[HttpGet("Encriptar")]
|
[HttpGet("Encriptar")]
|
||||||
public IActionResult Encriptar(string text, int tipo)
|
public IActionResult Encriptar(string text, int tipo)
|
||||||
{
|
{
|
||||||
if (!_encript.IsValid) return BadRequest("Lectura inválida");
|
if (!_encript.IsValid) return BadRequest("Lectura inv<EFBFBD>lida");
|
||||||
|
|
||||||
if (tipo == 0) return Ok(_encript.EncryptPwd(text));
|
if (tipo == 0) return Ok(_encript.EncryptPwd(text));
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
[HttpGet("Desencriptar")]
|
[HttpGet("Desencriptar")]
|
||||||
public IActionResult Desencriptar(string text, int tipo)
|
public IActionResult Desencriptar(string text, int tipo)
|
||||||
{
|
{
|
||||||
if (!_encript.IsValid) return BadRequest("Lectura inválida");
|
if (!_encript.IsValid) return BadRequest("Lectura inv<EFBFBD>lida");
|
||||||
|
|
||||||
if (tipo == 0) return Ok(_encript.DecryptPwd(text));
|
if (tipo == 0) return Ok(_encript.DecryptPwd(text));
|
||||||
|
|
||||||
@ -216,7 +216,8 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
new Claim("apellidos", apellidos),
|
new Claim("apellidos", apellidos),
|
||||||
new Claim("tipo_doc", tipo_doc.ToString()),
|
new Claim("tipo_doc", tipo_doc.ToString()),
|
||||||
new Claim("pk", user.NU_PK_USUMS.ToString()),
|
new Claim("pk", user.NU_PK_USUMS.ToString()),
|
||||||
new Claim("sedes", user.TX_SEDES_USUMS == null ? "" : user.TX_SEDES_USUMS)
|
new Claim("sedes", user.TX_SEDES_USUMS == null ? "" : user.TX_SEDES_USUMS),
|
||||||
|
new Claim("TX_NOMBRE_PVD", user.TX_NOMBRE_PVD ?? "{}")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<CorreosArea> lista = this._context.CORREOSAREAMS.ToList();
|
List<CORREOSAREAMS> lista = this._context.CORREOSAREAMS.ToList();
|
||||||
|
|
||||||
return Ok(lista);
|
return Ok(lista);
|
||||||
} catch (Exception ex)
|
} catch (Exception ex)
|
||||||
@ -30,7 +30,7 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult post([FromBody] CorreosArea nuevo)
|
public IActionResult post([FromBody] CORREOSAREAMS nuevo)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -47,12 +47,12 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPatch]
|
[HttpPatch]
|
||||||
public IActionResult patch([FromBody] CorreosArea actualizar)
|
public IActionResult patch([FromBody] CORREOSAREAMS actualizar)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CorreosArea? existente = this._context.CORREOSAREAMS.FirstOrDefault(c => c.NU_PK_CORA == actualizar.NU_PK_CORA);
|
CORREOSAREAMS? existente = this._context.CORREOSAREAMS.FirstOrDefault(c => c.NU_PK_CRRMS == actualizar.NU_PK_CRRMS);
|
||||||
if (existente == null) return BadRequest("Registro inexistente");
|
if (existente == null) return BadRequest("Registro inexistente");
|
||||||
|
|
||||||
this._context.Entry(existente).CurrentValues.SetValues(actualizar);
|
this._context.Entry(existente).CurrentValues.SetValues(actualizar);
|
||||||
|
@ -60,6 +60,7 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
var existe = _context.PERFILESMs.Find(editado.NU_PK_PFL);
|
var existe = _context.PERFILESMs.Find(editado.NU_PK_PFL);
|
||||||
|
|
||||||
existe.TX_PERFIL_PFL = editado.TX_PERFIL_PFL;
|
existe.TX_PERFIL_PFL = editado.TX_PERFIL_PFL;
|
||||||
|
existe.NU_ROL_PFL = editado.NU_ROL_PFL;
|
||||||
existe.BL_ESTADO_PFL = editado.BL_ESTADO_PFL;
|
existe.BL_ESTADO_PFL = editado.BL_ESTADO_PFL;
|
||||||
|
|
||||||
_context.PERFILESMs.Update(existe);
|
_context.PERFILESMs.Update(existe);
|
||||||
|
@ -257,7 +257,7 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
existe.NU_CARGO_USUMS = editado.NU_CARGO_USUMS;
|
existe.NU_CARGO_USUMS = editado.NU_CARGO_USUMS;
|
||||||
existe.NU_MODALIDADCTT_USUMS = editado.NU_MODALIDADCTT_USUMS;
|
existe.NU_MODALIDADCTT_USUMS = editado.NU_MODALIDADCTT_USUMS;
|
||||||
existe.TX_SEDES_USUMS = editado.TX_SEDES_USUMS;
|
existe.TX_SEDES_USUMS = editado.TX_SEDES_USUMS;
|
||||||
|
existe.NU_BLOQUEO_USUMS = editado.NU_BLOQUEO_USUMS;
|
||||||
|
|
||||||
ErrorModel errorPFLxUSUMS = await ActualizarRelaciones(existe.TX_PKDOC_USUMS, editado.TX_PKDOC_USUMS);
|
ErrorModel errorPFLxUSUMS = await ActualizarRelaciones(existe.TX_PKDOC_USUMS, editado.TX_PKDOC_USUMS);
|
||||||
|
|
||||||
|
@ -37,5 +37,6 @@ namespace MSAdminUsuarios.Dto
|
|||||||
public int? NU_CARGO_USUMS { get; set; }
|
public int? NU_CARGO_USUMS { get; set; }
|
||||||
public int? NU_MODALIDADCTT_USUMS { get; set; }
|
public int? NU_MODALIDADCTT_USUMS { get; set; }
|
||||||
public string? TX_SEDES_USUMS { get; set; }
|
public string? TX_SEDES_USUMS { get; set; }
|
||||||
|
public int? NU_BLOQUEO_USUMS { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using Microsoft.Extensions.Options;
|
|||||||
using RabbitMQ.Client;
|
using RabbitMQ.Client;
|
||||||
using MSAdminUsuarios.Utils;
|
using MSAdminUsuarios.Utils;
|
||||||
using RabbitMQ.Client.Events;
|
using RabbitMQ.Client.Events;
|
||||||
|
using Microsoft.AspNetCore.Rewrite;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ var logger = loggerFactory.CreateLogger(projectName);
|
|||||||
// Cadena de Conexion a Bases de Datos
|
// Cadena de Conexion a Bases de Datos
|
||||||
var ConString = builder.Configuration.GetSection("ConnectionStrings:ConString").Get<string>();
|
var ConString = builder.Configuration.GetSection("ConnectionStrings:ConString").Get<string>();
|
||||||
|
|
||||||
// Configuración del DbContext
|
// Configuraci<EFBFBD>n del DbContext
|
||||||
builder.Services.AddDbContext<ModelContext>(options =>
|
builder.Services.AddDbContext<ModelContext>(options =>
|
||||||
{
|
{
|
||||||
//IConfiguration configuration = builder.Configuration;
|
//IConfiguration configuration = builder.Configuration;
|
||||||
@ -73,7 +74,7 @@ builder.Services.AddSingleton<IConnection>(sp =>
|
|||||||
|
|
||||||
builder.Services.AddScoped<IModel>(provider =>
|
builder.Services.AddScoped<IModel>(provider =>
|
||||||
{
|
{
|
||||||
// Creación de channel, declaración de queues y binding
|
// Creaci<EFBFBD>n de channel, declaraci<63>n de queues y binding
|
||||||
return RabbitMQService.GetRabbitMQChannel(provider, projectName);
|
return RabbitMQService.GetRabbitMQChannel(provider, projectName);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -114,6 +115,10 @@ if(app.Environment.IsDevelopment())
|
|||||||
|
|
||||||
// app.UseHttpsRedirection();
|
// app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
var option = new RewriteOptions();
|
||||||
|
option.AddRedirect("^$", "swagger");
|
||||||
|
app.UseRewriter(option);
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
Loading…
Reference in New Issue
Block a user