private bool UserHasPermissionForTenant(string tenant, System.Security.Claims.ClaimsPrincipal user) { if (tenant == null) { return(true); } if (user == null) { return(false); } return(user.HasClaim(_options.ClaimName, tenant.ToUpper())); }
public async Task <bool> PermisoMostrarEditarIndicador(System.Security.Claims.ClaimsPrincipal user, Indicador indicador) { ResponsablesController controlResponsable = new ResponsablesController(db, userManager); var userFull = await userManager.FindByEmailAsync(user.Identity.Name); var ids = controlResponsable.GetAllIdsFromResponsable(userFull.IDDependencia); //---------------------- hernecia de responsabilidades if (((ids.Contains(indicador.Categoria.IdResponsable)) && user.HasClaim(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/Indicador.Editar" && c.Value == "1"))) //if (super || (usuario.IDDependencia == indicador.Categoria.IdResponsable && permiso )) { return(true); } else { return(false); } }
public async Task <bool> PermisoEditarEjecucionPlaneado(System.Security.Claims.ClaimsPrincipal user, Ejecucion ejecucion) { ResponsablesController controlResponsable = new ResponsablesController(db, userManager); var userFull = await userManager.FindByEmailAsync(user.Identity.Name); var ids = controlResponsable.GetAllIdsFromResponsable(userFull.IDDependencia); //---------------------- hernecia de responsabilidades if (((ids.Contains(ejecucion.Indicador.Categoria.IdResponsable)) && user.HasClaim(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/Planeacion.Editar" && c.Value == "1") && (ejecucion.Periodo.EditarProgramacion == true))) { return(true); } else { return(false); } }