protected void Page_Load(object sender, EventArgs e) { SafetypadWS wsInterface = new SafetypadWS(); safetypadWS = new SafetypadWS(); Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager scm = (Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager)System.Configuration.ConfigurationManager.GetSection("safetypad-client"); /*Ni.Com.Xolo.Safetypad.Ws.Wrappers.Account var = * (Ni.Com.Xolo.Safetypad.Ws.Wrappers.Account)safetypadWS.GetAccount(Session.SessionID, scm.ApplicationName);* * * /*lbUsername.Text = var.Login; * lbSesiones.Text = Session["totalActiveSessions"].ToString(); * lbLastIp.Text = Session["lastLoginIp"].ToString(); * lbLastAccess.Text = Session["lastLoginDate"].ToString(); * * lbMenu.Text = Session["menu"].ToString(); * lbResources.Text = Session["resources"].ToString(); * lbYear.Text = DateTime.Now.Year.ToString(); */ string Host_Usuario = Request.ServerVariables["AUTH_USER"]; Session["vs_user_name"] = Host_Usuario; Session["vs_user_name"] = Session["vs_user_name"].ToString().ToUpper(); Session["vs_user_name"] = Session["vs_user_name"].ToString().Replace("TCN\\", ""); Session["vs_user_name"] = Session["vs_user_name"].ToString().Replace("INTRA\\", ""); Session["vs_user_name"] = Session["vs_user_name"].ToString().ToUpper(); Session["v_ip"] = Request.ServerVariables["REMOTE_ADDR"]; }
/// <summary> /// Obtiene el valor del Parametro de la seguridad /// </summary> /// <param name="parametro">1 - Parametro1 / 2 - Parametro2 / 3 - Parametro3</param> /// <returns>-1 No encontrado o Error / Valor del Parametro </returns> public static String GetParameterXSA_CUENTA(int parametro) { string result = "-1"; try { SafetypadWS wsInterface = new SafetypadWS(); Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager scm = ((Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager)(System.Configuration.ConfigurationManager.GetSection("safetypad-client"))); var Data = wsInterface.GetAccount(HttpContext.Current.Session.SessionID, scm.ApplicationName); if (parametro == 1) { result = Data.Parametro1.ToUpper(); } else if (parametro == 2) { result = Data.Parametro2; } else if (parametro == 3) { result = Data.Parametro3; } else { result = "-1"; } } catch (Exception ex) { result = "-1"; } return(result); }
/// <summary> /// Registra una marca de auditoria /// Autor: Ervin Isaba /// Fecha: 05/04/2010 /// Version: 1.0 /// </summary> /// <param name="username">Usuario que realiza el registro de auditoria</param> /// <param name="fieldNames">Nombre de campos a afectar</param> /// <param name="fieldValues">Nombre de valores correspondientes a los campos a afectar</param> /// <param name="dbObject">Nombre de tabla a afectar</param> /// <param name="crud">C-Crear, R-Read, U-Actualizar, D-Borrar, A-Access</param> public static void RegAuditTrail(String username, String[] fieldNames, String[] fieldValues, String dbObject, String crud) { try { HttpContext page = HttpContext.Current; SafetypadWS wsInterface = new SafetypadWS(); Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager scm = ((Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager)(System.Configuration.ConfigurationManager.GetSection("safetypad-client"))); wsInterface.RegistreAuditTrailEntryByResource(scm.ApplicationCode, scm.ApplicationName, page.Request.Url.AbsolutePath, username, GetIpClient(), page.Session.SessionID, GetServerName(false), crud, GetXML(dbObject, fieldNames, fieldValues), GetServerName(true)); } catch (Exception) { } }
/// <summary> /// Descripcion: Determina si una accion es permitida para el usuario logeado en el sistema /// Autor: Ervin Isaba /// Fecha: 05/04/2010 /// Version: 1.0 /// </summary> /// <param name="action">Accion a evaluar</param> /// <returns>True si la accion es permitida para el usuario.</returns> public static bool IsAllowed(String action) { try { HttpContext page = HttpContext.Current; SafetypadWS wsInterface = new SafetypadWS(); Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager scm = ((Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager)(System.Configuration.ConfigurationManager.GetSection("safetypad-client"))); return(wsInterface.IsActionAllowed(page.Session.SessionID, scm.ApplicationName, page.Request.Url.AbsolutePath, action)); } catch (Exception) { return(false); } }
/// <summary> /// Registra las excepciones de la aplicacion en el modulo de seguridad /// Autor: Ervin Isaba /// Fecha: 05/04/2010 /// Version: 1.0 /// </summary> /// <param name="source">Nombre de fuente o archivo donde ocurre la excepción</param> /// <param name="stackTrace">Pila de la excepción ej.(ex.ToString())</param> public static void SetLogRecord(String source, String stackTrace) { try { // Establecemos el web service del modulo de seguridad SafetypadWS wsInterface = new SafetypadWS(); //Declaramos los objetos para la manipulacion de los datos que regresa el modulo de seguridad Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager scm = ((Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager)(System.Configuration.ConfigurationManager.GetSection("safetypad-client"))); // Registramos el error wsInterface.RegistreException(HttpContext.Current.Session.SessionID, scm.ApplicationName, scm.ApplicationName + "_" + source, DateTime.Now, stackTrace, "", HttpContext.Current.Request.Browser.Browser.ToString(), HttpContext.Current.Request.Url.ToString()); } catch { } }
/// <summary> /// Retorna el nombre login del usuario. /// Autor: Ervin Isaba /// Fecha: 05/04/2010 /// Version: 1.0 /// </summary> /// <returns>Nombre de login de usuario</returns> public static String GetUserLogin() { try { SafetypadWS wsInterface = new SafetypadWS(); String login = ""; Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager scm = ((Ni.Com.Xolo.Safetypad.Web.Client.SafetypadClientManager)(System.Configuration.ConfigurationManager.GetSection("safetypad-client"))); var application = wsInterface.GetSessionUser(HttpContext.Current.Session.SessionID, scm.ApplicationCode); login = application.Login; return(login); } catch { return(""); } }