Compare commits
2 Commits
702c097c32
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8255115560 | |||
| 6349a50151 |
@@ -6,6 +6,8 @@
|
||||
@inject NavigationManager Navigation
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
@inject UserState userState
|
||||
@inject IJSRuntime JS
|
||||
|
||||
|
||||
<head>
|
||||
@@ -106,32 +108,55 @@
|
||||
@code {
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
// protected override async Task OnInitializedAsync()
|
||||
// {
|
||||
// // Redirigir al home si no hay token y la ruta no es pública
|
||||
// if (userState.idUser == 0)
|
||||
// {
|
||||
// Navigation.NavigateTo("/", true);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
string? urlAnterior = "";
|
||||
|
||||
bool urlVaida = true;
|
||||
string rutaActual = "";
|
||||
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
var obtenerDatoAdmin = await ProtectedLocalStore.GetAsync<bool>("EsAdmin");
|
||||
var obtenerDatoId = await ProtectedLocalStore.GetAsync<int>("idUsuario");
|
||||
// Redirigir al home si no hay token y la ruta no es pública
|
||||
if (obtenerDatoId.Value == 0 || !obtenerDatoAdmin.Value)
|
||||
if (firstRender)
|
||||
{
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(urlAnterior))
|
||||
{
|
||||
|
||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (!urlAnterior.Contains("cacoa.es"))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
|
||||
|
||||
if (userState.idUser == 0)
|
||||
{
|
||||
Navigation.NavigateTo("/", true);
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// protected override void OnAfterRender(bool firstRender)
|
||||
// {
|
||||
// if (firstRender)
|
||||
// {
|
||||
// string? urlAnterior = HttpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString();
|
||||
// string rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
// if (rutaActual != "Denegado")
|
||||
// {
|
||||
// if (string.IsNullOrEmpty(urlAnterior) || urlAnterior.Contains("cacoa.es"))
|
||||
// {
|
||||
// Navigation.NavigateTo("/Denegado", true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -51,23 +51,28 @@
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(urlAnterior))
|
||||
{
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referer");
|
||||
|
||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(urlAnterior) && urlAnterior.Contains("cacoa.es"))
|
||||
if (!urlAnterior.Contains("cacoa.es") )
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
@inject NavigationManager Navigation
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
@inject UserState userState
|
||||
@inject IJSRuntime JS
|
||||
|
||||
|
||||
<head>
|
||||
@@ -111,15 +113,54 @@
|
||||
@code {
|
||||
private bool MostrarExtra => Navigation.Uri.Contains("PanelControl", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
||||
string? urlAnterior = "";
|
||||
|
||||
bool urlVaida = true;
|
||||
string rutaActual = "";
|
||||
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
var obtenerDatoAdmin = await ProtectedLocalStore.GetAsync<bool>("EsAdmin");
|
||||
var obtenerDatoId = await ProtectedLocalStore.GetAsync<int>("idUsuario");
|
||||
// Redirigir al home si no hay token y la ruta no es pública
|
||||
if (obtenerDatoId.Value == 0 || obtenerDatoAdmin.Value)
|
||||
if (firstRender)
|
||||
{
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(urlAnterior))
|
||||
{
|
||||
|
||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (!urlAnterior.Contains("cacoa.es"))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
|
||||
|
||||
if (userState.idUser == 0 )
|
||||
{
|
||||
Navigation.NavigateTo("/", true);
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
// Redirigir al home si no hay token y la ruta no es pública
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -116,10 +116,10 @@
|
||||
|
||||
@* TABLA DE DATOS OPCIONALES *@
|
||||
|
||||
<div class="TituloTablaImprimir" style="@espacioDocumentos">
|
||||
<div class="TituloTablaImprimir" style="margin-top:10px;">
|
||||
</div>
|
||||
|
||||
<div class="TituloTablaImprimir" style="@espacioDocumentos">
|
||||
<div class="TituloTablaImprimir">
|
||||
<b>Documentación Opcional:</b>
|
||||
</div>
|
||||
<div class="table-responsive espacioTablas">
|
||||
@@ -199,8 +199,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* FASES *@
|
||||
<div class="col-8 mx-auto" style="margin-top:250px;">
|
||||
<div class="col-8 mx-auto" style="margin-top:150px;">
|
||||
|
||||
<div class="TituloTablaImprimir" style=" margin-top:50px;">
|
||||
<b>Fases:</b>
|
||||
@@ -249,7 +250,7 @@
|
||||
</div>
|
||||
|
||||
@* INNOVACIÓN INSTRUMENTOS*@
|
||||
<div class="col-11 mx-auto ">
|
||||
<div class="col-11 mx-auto" style="margin-top:150px;">
|
||||
<div>
|
||||
<div class="mt-3 mb-3 TituloTablaImprimir"><b>Innovacion de los instrumentos</b></div>
|
||||
<p style="font-size:9pt;" class="col-6">
|
||||
@@ -285,7 +286,10 @@
|
||||
|
||||
<div class="col-8 mx-auto mt-4">
|
||||
@* Solvencia tecnica *@
|
||||
<div class="TituloTablaImprimir">
|
||||
|
||||
<div class="TituloTablaImprimir" style="margin-top:50px;">
|
||||
</div>
|
||||
<div class="TituloTablaImprimir" style="margin-top:50px;">
|
||||
<b>Solvencia técnica:</b>
|
||||
</div>
|
||||
|
||||
@@ -441,7 +445,7 @@
|
||||
|
||||
if (objetoLicitacionUrban.TrabajoProfesional.idTipoDocumentacion != 0)
|
||||
{
|
||||
espacioDocumentos = "margin-top:300px;";
|
||||
espacioDocumentos = "margin-top:50px;";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<InputText @bind-Value="objetoLicitacionUrban.NombreSimulacion" class="form-control inputForm formatoMoneda inputTabla " style="text-align:left;font-weight:bold;"></InputText>
|
||||
</div>
|
||||
<div class="d-flex ml-auto impriManual">
|
||||
@* <button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button> *@
|
||||
<button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button>
|
||||
<button @onclick="VerManual" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-book pe-2"></i>Manual</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -70,10 +70,10 @@
|
||||
await ProtectedLocalStore.SetAsync("EsAdmin", false);
|
||||
|
||||
// Limpiar almacenamiento local o sesión si se está utilizando
|
||||
// if (HttpContextAccessor?.HttpContext?.Session != null)
|
||||
// {
|
||||
// HttpContextAccessor.HttpContext.Session.Clear();
|
||||
// }
|
||||
if (HttpContextAccessor?.HttpContext?.Session != null)
|
||||
{
|
||||
HttpContextAccessor.HttpContext.Session.Clear();
|
||||
}
|
||||
|
||||
var rec = await ProtectedLocalStore.GetAsync<bool>("rec");
|
||||
if(rec.Value==true){
|
||||
@@ -97,6 +97,9 @@
|
||||
await ProtectedLocalStore.SetAsync("idUsuario", -1);
|
||||
await ProtectedLocalStore.SetAsync("EsAdmin", true);
|
||||
|
||||
UserState.idUser = -1;
|
||||
UserState.PuedeAcceder =true;
|
||||
|
||||
Navigation.NavigateTo("/PanelControlConf", forceLoad: true);
|
||||
}
|
||||
else
|
||||
@@ -113,6 +116,9 @@
|
||||
await ProtectedLocalStore.SetAsync("idUsuario", usuario.idUsuario);
|
||||
await ProtectedLocalStore.SetAsync("EsAdmin", false);
|
||||
|
||||
UserState.idUser = usuario.idUsuario;
|
||||
UserState.PuedeAcceder =true;
|
||||
|
||||
|
||||
if (recuerda)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
private readonly object _lock = new object();
|
||||
private int _idUser;
|
||||
private bool _esAdmin;
|
||||
private bool _puedeAcceder;
|
||||
public int idUser
|
||||
{
|
||||
get
|
||||
@@ -41,5 +42,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool PuedeAcceder
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
return _puedeAcceder;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
_puedeAcceder = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user