bueno ya esta implemntado todo lo de permisos de forma recursiva
This commit is contained in:
@@ -5,21 +5,25 @@ using Modelo;
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class LogsController: ControllerBase {
|
||||
public class LogsController : ControllerBase
|
||||
{
|
||||
|
||||
[HttpGet("/api/Logs")]
|
||||
public IActionResult ObtenerLogs([FromHeader(Name = "Auth")] string Auth, int pag=1) {
|
||||
public IActionResult ObtenerLogs([FromHeader(Name = "Auth")] string Auth, int pag = 1)
|
||||
{
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 7);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
if (pag<=0) return BadRequest(new { message = "no puede haber una pagina 0 o menor"});
|
||||
if (pag <= 0) return BadRequest(new { message = "no puede haber una pagina 0 o menor" });
|
||||
|
||||
pag-=1;
|
||||
pag -= 1;
|
||||
|
||||
var l = RepositorioLogs.Singleton.ObtenerLogsPaginado(pag);
|
||||
List<LogDto> ll = new();
|
||||
foreach (var i in l) {
|
||||
ll.Add(new LogDto{
|
||||
foreach (var i in l)
|
||||
{
|
||||
ll.Add(new LogDto
|
||||
{
|
||||
Fecha = i.Fecha,
|
||||
Accion = i.Accion,
|
||||
Dniusuario = i.Dniusuario,
|
||||
@@ -29,16 +33,19 @@ public class LogsController: ControllerBase {
|
||||
}
|
||||
|
||||
[HttpGet("/api/Logs/detalle")]
|
||||
public IActionResult ObtenerLogs([FromHeader(Name = "Auth")] string Auth, [FromQuery]DateTime fecha, [FromQuery]long idusuario) {
|
||||
public IActionResult ObtenerLogs([FromHeader(Name = "Auth")] string Auth, [FromQuery] DateTime fecha, [FromQuery] long idusuario)
|
||||
{
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 7);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
if (idusuario<=0) return BadRequest(new { message = "no puede haber un id 0 o menor"});
|
||||
if (idusuario <= 0) return BadRequest(new { message = "no puede haber un id 0 o menor" });
|
||||
|
||||
var l = RepositorioLogs.Singleton.ObtenerDetallesLogs(fecha, idusuario);
|
||||
List<LogDetalleDto> ll = new();
|
||||
foreach (var i in l) {
|
||||
ll.Add(new LogDetalleDto{
|
||||
foreach (var i in l)
|
||||
{
|
||||
ll.Add(new LogDetalleDto
|
||||
{
|
||||
Fecha = i.Fecha,
|
||||
Dniusuario = i.Dniusuario,
|
||||
NombreTabla = i.NombreTabla,
|
||||
@@ -51,12 +58,13 @@ public class LogsController: ControllerBase {
|
||||
}
|
||||
|
||||
[HttpGet("/api/Logs/cantPag")]
|
||||
public IActionResult cantidadPaginas([FromHeader(Name = "Auth")] string Auth){
|
||||
public IActionResult cantidadPaginas([FromHeader(Name = "Auth")] string Auth)
|
||||
{
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 7);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
int c = RepositorioLogs.Singleton.ObtenerCantidadPaginas();
|
||||
return Ok(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user