public CustomEditFreetextKeyword(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); propdata = new Profiles.Profile.Utilities.DataIO(); data = new Profiles.Edit.Utilities.DataIO(); string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#"); this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false); PropertyLabel = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value; if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID + "'>Edit Menu</a> > <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>"; //btnEditProperty.Text = "Add " + PropertyLabel; imbAddArror.Visible = true; this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false); this.MaxCardinality = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@MaxCardinality").Value; this.MinCardinality = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@MinCardinality").Value; securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = predicateuri; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); txtLabel.Attributes.Add("data-autocomplete-url", Root.Domain + "/edit/Modules/CustomEditFreetextKeyword/keywordAutocomplete.aspx?keys="); }
public MainMenu(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { menulist = new System.Text.StringBuilder(); sm = new SessionManagement(); ActiveNetworkRelationshipTypes.ClassURI = ""; }
public EditDataTypeProperty(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); data = new Edit.Utilities.DataIO(); string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#"); this.PropertyListXML = data.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false); PropertyLabel = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value; if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID + "'>Edit Menu</a> > <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>"; btnEditProperty.Text = "Add " + PropertyLabel; this.PropertyListXML = data.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false); securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = predicateuri; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); }
private void DrawProfilesModule() { XsltArgumentList args = new XsltArgumentList(); XslCompiledTransform xslt = new XslCompiledTransform(); SessionManagement sm = new SessionManagement(); Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); string email = string.Empty; string imageemailurl = string.Empty; if (this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces) != null && this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/vivo:email", this.Namespaces) == null) { email = this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces).InnerText; imageemailurl = string.Format(Root.Domain + "/profile/modules/CustomViewPersonGeneralInfo/" + "EmailHandler.ashx?msg={0}", HttpUtility.UrlEncode(email)); } args.AddParam("root", "", Root.Domain); if (email != string.Empty) { args.AddParam("email", "", imageemailurl); } args.AddParam("imgguid", "", Guid.NewGuid().ToString()); litPersonalInfo.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/CustomViewPersonGeneralInfo/CustomViewPersonGeneralInfo.xslt"), args, base.BaseData.OuterXml); if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces) != null) { string imageurl = base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces).Value; imgPhoto.ImageUrl = imageurl + "&cachekey=" + Guid.NewGuid().ToString(); } else { imgPhoto.Visible = false; } }
public static long getNodeIdFromInternalUserName(string internalUserName) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("select nodeID from [RDF.Stage].[InternalNodeMap] m join [Profile.Data].[Person] p on m.internalID= p.PersonID and Class = 'http://xmlns.com/foaf/0.1/Person' and p.internalusername = '******'"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.Text; dbcommand.CommandTimeout = GetCommandTimeout(); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) { ORCIDPublication pub = new ORCIDPublication(); if (dbreader["NodeID"] != null) { return Convert.ToInt64(dbreader["NodeID"]); } } return 0; }
public void InsertProxy(string userid) { SessionManagement sm = new SessionManagement(); try { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); dbconnection.Open(); SqlCommand dbcommand = new SqlCommand(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandText = "[User.Account].[Proxy.AddDesignatedProxy]"; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@SessionID", sm.Session().SessionID)); dbcommand.Parameters.Add(new SqlParameter("@UserID", userid)); dbcommand.Connection = dbconnection; dbcommand.ExecuteNonQuery(); } catch (Exception e) { throw new Exception(e.Message); } }
public CustomEditMainImage(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { Edit.Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO(); SessionManagement sm = new SessionManagement(); this.XMLData = pagedata; propdata = new Profiles.Profile.Utilities.DataIO(); if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); this.PredicateURI = Request.QueryString["predicateuri"].Replace("!", "#"); this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, PredicateURI, false, true, false); litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> > <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>"; securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = PredicateURI; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); securityOptions.BubbleClick += SecurityDisplayed; }
public CustomEditMailingAddress(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); base.BaseData = pagedata; data = new Edit.Utilities.DataIO(); if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#"); this.PropertyListXML = data.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false); litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> > <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>"; //create a new network triple request. base.RDFTriple = new RDFTriple(this.SubjectID, data.GetStoreNode(predicateuri)); base.RDFTriple.Expand = true; base.RDFTriple.ShowDetails = true; base.GetDataByURI();//This will reset the data to a Network. securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = predicateuri; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); }
/* public SqlDataReader GetPublications(RDFTriple request) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("[Profile.Module].[CustomViewAuthorInAuthorshipForORCID.GetList]"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@nodeid", request.Subject)); dbcommand.Parameters.Add(new SqlParameter("@sessionid", sm.Session().SessionID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); return dbreader; } */ public string GetInternalUserID() { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand("SELECT UserID, InternalUserName FROM [User.Account].[User] WHERE (UserID = @userid)"); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.Text; dbcommand.CommandTimeout = GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@userid", sm.Session().UserID)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) { ORCIDPublication pub = new ORCIDPublication(); if (dbreader["InternalUserName"] != null) { return dbreader["InternalUserName"].ToString(); } } throw new Exception("Unable to find Internal Username"); }
public System.Xml.Linq.XDocument GetConceptMeshInfo(RDFTriple request) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; using (var db = new SqlConnection(connstr)) { SqlCommand dbcommand = new SqlCommand("[Profile.Data].[Concept.Mesh.GetDescriptorXML]", db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); db.Open(); XmlReader xreader = dbcommand.ExecuteXmlReader(); System.Xml.Linq.XDocument xDoc = null; if (xreader.Read()) xDoc = System.Xml.Linq.XDocument.Load(xreader); xreader.Close(); db.Close(); return xDoc; } }
/// <summary> /// For User Authentication /// </summary> /// <param name="user"></param> /// <param name="session"></param> public bool UserLogin(ref User user) { bool loginsuccess = false; try { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlParameter[] param = new SqlParameter[4]; dbconnection.Open(); param[0] = new SqlParameter("@UserName", user.UserName); param[1] = new SqlParameter("@Password", user.Password); param[2] = new SqlParameter("@UserID", null); param[2].DbType = DbType.Int32; param[2].Direction = ParameterDirection.Output; param[3] = new SqlParameter("@PersonID", null); param[3].DbType = DbType.Int32; param[3].Direction = ParameterDirection.Output; //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value. ExecuteSQLDataCommand(GetDBCommand(ref dbconnection, "[User.Account].[Authenticate]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param)); dbconnection.Close(); try { user.UserID = Convert.ToInt32(param[2].Value.ToString()); if (param[3].Value != DBNull.Value) user.PersonID = Convert.ToInt32(param[3].Value.ToString()); } catch { } if (user.UserID != 0) { loginsuccess = true; sm.Session().UserID = user.UserID; sm.Session().PersonID = user.PersonID; sm.Session().LoginDate = DateTime.Now; Session session = sm.Session(); SessionUpdate(ref session); ActivityLog(user.PersonID, null, null); } } catch (Exception ex) { throw ex; } return loginsuccess; }
private void DrawProfilesModule() { XsltArgumentList args = new XsltArgumentList(); XslCompiledTransform xslt = new XslCompiledTransform(); SessionManagement sm = new SessionManagement(); Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); string email = string.Empty; string imageemailurl = string.Empty; if (this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces) != null && this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/vivo:email", this.Namespaces) == null) { email = this.BaseData.SelectSingleNode("rdf:RDF[1]/rdf:Description[1]/prns:emailEncrypted", this.Namespaces).InnerText; imageemailurl = string.Format(Root.Domain + "/profile/modules/CustomViewPersonGeneralInfo/" + "EmailHandler.ashx?msg={0}", HttpUtility.UrlEncode(email)); } args.AddParam("root", "", Root.Domain); if (email != string.Empty) { args.AddParam("email", "", imageemailurl); } args.AddParam("imgguid", "", Guid.NewGuid().ToString()); // Check for an ORCID string internalUsername = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.Profile.Data.Person().GetInternalUsername(Convert.ToInt64(Request.QueryString["Subject"])); Profiles.ORCID.Utilities.ProfilesRNSDLL.BO.ORCID.Person orcidPerson = new Profiles.ORCID.Utilities.ProfilesRNSDLL.BLL.ORCID.Person().GetByInternalUsername(internalUsername); if (orcidPerson.Exists && !orcidPerson.ORCIDIsNull) { args.AddParam("orcid", "", orcidPerson.ORCID); args.AddParam("orcidurl", "", Profiles.ORCID.Utilities.config.ORCID_URL + "/" + orcidPerson.ORCID); args.AddParam("orcidinfosite", "", Profiles.ORCID.Utilities.config.InfoSite); args.AddParam("orcidimage", "", Root.Domain + "/Framework/Images/orcid_16x16(1).gif"); args.AddParam("orcidimageguid", "", Guid.NewGuid().ToString()); } else if (Profiles.ORCID.Utilities.config.ShowNoORCIDMessage && Profiles.ORCID.Utilities.config.Enabled) { //args.AddParam("orcid", "", "No ORCID id has been created for this user"); args.AddParam("orcid", "", "Login to create your ORCID iD"); args.AddParam("orcidinfosite", "", Profiles.ORCID.Utilities.config.InfoSite); string qs = HttpUtility.UrlEncode("predicateuri=http%3a%2f%2fvivoweb.org%2fontology%2fcore!orcidId&module=DisplayItemToEdit&ObjectType=Literal"); args.AddParam("orcidurl", "", Root.Domain + "/login/default.aspx?method=login&edit=true&editparams=" + qs); args.AddParam("orcidimage", "", Root.Domain + "/Framework/Images/orcid_16x16(1).gif"); args.AddParam("orcidimageguid", "", Guid.NewGuid().ToString()); } litPersonalInfo.Text = XslHelper.TransformInMemory(Server.MapPath("~/Profile/Modules/CustomViewPersonGeneralInfo/CustomViewPersonGeneralInfo.xslt"), args, base.BaseData.OuterXml); if (base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces) != null) { string imageurl = base.BaseData.SelectSingleNode("//rdf:RDF/rdf:Description[1]/prns:mainImage/@rdf:resource", base.Namespaces).Value; imgPhoto.ImageUrl = imageurl + "&cachekey=" + Guid.NewGuid().ToString(); } else { imgPhoto.Visible = false; } }
//*************************************************************************************************************************************** /// <summary> /// /// Starts a Profiles instance of Profiles Session Management and Session State Information used for /// security/data filters, tracking, auditing. /// /// </summary> /// <param name="sender"> .Net context object</param> /// <param name="e"> .Net Event Arguments</param> protected void Session_Start(object sender, EventArgs e) { SessionManagement session = new SessionManagement(); session.SessionCreate(); if (session.Session() != null) Framework.Utilities.DebugLogging.Log("SESSION CREATED for: " + session.Session().SessionID); session = null; }
public EditObjectTypeProperty(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { Edit.Utilities.DataIO data; SessionManagement sm = new SessionManagement(); Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO(); data = new Profiles.Edit.Utilities.DataIO(); if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); this.PredicateURI = Request.QueryString["predicateuri"].Replace("!", "#"); GetSubjectProfile(); this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, PredicateURI, false, true, false); this.PropertyLabel = PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value; litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> > <b>" + this.PropertyLabel + "</b>"; //Quick add for adding a note on the format of grant info when adding manually if (PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/@Label").Value == "Research") { litGrantNote1.Text = "Please use the following format when adding the grant information: "; litGrantNote2.Text = "Funding Agency: Agency Name - Title: Grant Title - Award Number: Grant ID Number - Total direct costs: $amount - Start Date: yyyy-mm-dd - End Date: yyyy-mm-dd <br /> Or for subaward:<br /> Subaward: Name of Pass-Through Institution - Funding Agency: Agency Name - Title: Grant Title - Award Number: Grant ID Number - Total direct costs: $amount - Start Date: yyyy-mm-dd - End Date: yyyy-mm-dd"; } //Quick fix to allow only Admin and Curators to edit Visibility privacy securityOptions.userRole = propdata.GetUserRole(sm.Session().SessionID); if (securityOptions.userRole == -40 || securityOptions.userRole == -50) { securityOptions.FindControl("imbSecurityOptions").Visible = true; securityOptions.FindControl("lbSecurityOptions").Visible = true; } else { securityOptions.FindControl("imbSecurityOptions").Visible = false; securityOptions.FindControl("lbSecurityOptions").Visible = false; } securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = PredicateURI; this.PredicateID = data.GetStoreNode(this.PredicateURI); securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); this._subject = Convert.ToInt64(Request.QueryString["subject"]); this._personId = data.GetPersonID(_subject); }
public EditDataTypeProperty(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); propdata = new Profiles.Profile.Utilities.DataIO(); data = new Profiles.Edit.Utilities.DataIO(); string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#"); this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false); PropertyLabel = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value; if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID + "'>Edit Menu</a> > <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>"; btnEditProperty.Text = "Add " + PropertyLabel; this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false); // Put hack to not insert null MaxCardinality Value if (this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@MaxCardinality") == null) { this.MaxCardinality = "1"; } else { this.MaxCardinality = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@MaxCardinality").Value; } this.MinCardinality = this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@MinCardinality").Value; //Quick fix to allow only Admin and Curators to edit Visibility privacy securityOptions.userRole = propdata.GetUserRole(sm.Session().SessionID); if (securityOptions.userRole == -40 || securityOptions.userRole == -50) { securityOptions.FindControl("imbSecurityOptions").Visible = true; securityOptions.FindControl("lbSecurityOptions").Visible = true; } else { securityOptions.FindControl("imbSecurityOptions").Visible = false; securityOptions.FindControl("lbSecurityOptions").Visible = false; } securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = predicateuri; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); }
public PropertyList(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { XmlDocument presentationxml = base.PresentationXML; SessionManagement sm = new SessionManagement(); Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); this.PropertyListXML = data.GetPropertyList(pagedata, presentationxml,"",false,false,true); mp = new ModulesProcessing(); }
/// <summary> /// Used to create a custom Profiles Session instance. This instance is used to track and store user activity as a form of Profiles Network. /// </summary> /// <param name="session">ref of Framework.Session object that stores the state of a Profiles user session</param> public void SessionUpdate(ref Session session) { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SessionManagement sm = new SessionManagement(); SqlConnection dbconnection = new SqlConnection(connstr); SqlParameter[] param; param = new SqlParameter[6]; SqlCommand dbcommand = new SqlCommand(); dbconnection.Open(); dbcommand.CommandTimeout = this.GetCommandTimeout(); param[0] = new SqlParameter("@SessionID", session.SessionID); param[1] = new SqlParameter("@UserID", session.UserID); param[2] = new SqlParameter("@LastUsedDate", session.LastUsedDate); param[3] = new SqlParameter("@SessionPersonNodeID", 0); param[3].Direction = ParameterDirection.Output; param[4] = new SqlParameter("@SessionPersonURI", SqlDbType.VarChar, 400); param[4].Direction = ParameterDirection.Output; if (session.LogoutDate > DateTime.Now.AddDays(-5)) { param[5] = new SqlParameter("@LogoutDate", session.LogoutDate.ToString()); } dbcommand.Connection = dbconnection; try { //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value. ExecuteSQLDataCommand(GetDBCommand(ref dbconnection, "[User.Session].[UpdateSession]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param)); } catch (Exception ex) { } try { dbcommand.Connection.Close(); session.NodeID = Convert.ToInt64(param[3].Value); session.PersonURI = param[4].Value.ToString(); } catch (Exception ex) { } }
public CustomEditAwardOrHonor(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); this.XMLData = pagedata; data = new Edit.Utilities.DataIO(); Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO(); if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); string predicateuri = Request.QueryString["predicateuri"].Replace("!", "#"); this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, predicateuri, false, true, false); this.PredicateID = data.GetStoreNode(predicateuri); base.GetNetworkProfile(this.SubjectID, this.PredicateID); litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> > <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>"; securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = predicateuri; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); if (Request.QueryString["new"] != null && Session["new"] != null) { Session["pnlInsertAward.Visible"] = null; Session["new"] = null; if (Session["newclose"] != null) { Session["newclose"] = null; btnInsertCancel_OnClick(this,new EventArgs()); } else { btnEditAwards_OnClick(this, new EventArgs()); } } securityOptions.BubbleClick += SecurityDisplayed; }
public CustomEditEmail(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); base.BaseData = pagedata; data = new Profiles.Edit.Utilities.DataIO(); this.Email = base.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/vivo:email", base.Namespaces).InnerText; Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO(); if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); this.PredicateURI = Request.QueryString["predicateuri"].Replace("!", "#"); this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, this.PredicateURI, false, true, false); litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> > <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>"; //create a new network triple request. base.RDFTriple = new RDFTriple(this.SubjectID, data.GetStoreNode(this.PredicateURI)); base.RDFTriple.Expand = true; base.RDFTriple.ShowDetails = true; base.GetDataByURI();//This will reset the data to a Network. //Quick fix to allow only Admin and Curators to edit Visibility privacy securityOptions.userRole = propdata.GetUserRole(sm.Session().SessionID); if (securityOptions.userRole == -40 || securityOptions.userRole == -50) { securityOptions.FindControl("imbSecurityOptions").Visible = true; securityOptions.FindControl("lbSecurityOptions").Visible = true; } else { securityOptions.FindControl("imbSecurityOptions").Visible = false; securityOptions.FindControl("lbSecurityOptions").Visible = false; } securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = this.PredicateURI; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); }
public SqlDataReader GetConceptSimilarMesh(RDFTriple request) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; var db = new SqlConnection(connstr); db.Open(); SqlCommand dbcommand = new SqlCommand("[Profile.Data].[Concept.Mesh.GetSimilarMesh]", db); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = base.GetCommandTimeout(); // Add parameters dbcommand.Parameters.Add(new SqlParameter("@NodeId", request.Subject)); // Return reader return dbcommand.ExecuteReader(CommandBehavior.CloseConnection); }
public void AddCustomPublication(Hashtable parameters, int personid, long subjectID, XmlDocument PropertyListXML) { ActivityLog(PropertyListXML, subjectID, parameters["@HMS_PUB_CATEGORY"].ToString(), parameters["@PUB_TITLE"].ToString()); string skey = string.Empty; string sparam = string.Empty; try { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand comm = new SqlCommand(); string s = string.Empty; foreach (object key in parameters.Keys) { skey = (string)key; sparam = (string)parameters[skey].ToString(); comm.Parameters.Add(new SqlParameter(skey, sparam)); s = s + skey + "='" + sparam + "'"; } comm.Connection = dbconnection; comm.Connection.Open(); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "[Profile.Data].[Publication.MyPub.AddPublication]"; comm.ExecuteScalar(); comm.Connection.Close(); if (dbconnection.State != ConnectionState.Closed) dbconnection.Close(); this.UpdateEntityOnePerson(personid); } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } }
public EditPersonalGadget(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); base.BaseData = pagedata; data = new Profiles.ORNG.Utilities.DataIO(); Profiles.Edit.Utilities.DataIO editdata = new Profiles.Edit.Utilities.DataIO(); Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO(); if (Request.QueryString["subject"] != null) this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]); else if (base.GetRawQueryStringItem("subject") != null) this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject")); else Response.Redirect("~/search"); this.PredicateURI = Request.QueryString["predicateuri"].Replace("!", "#"); this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, this.PredicateURI, false, true, false); litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> > <b>" + PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value + "</b>"; //create a new network triple request. base.RDFTriple = new RDFTriple(this.SubjectID, editdata.GetStoreNode(this.PredicateURI)); base.RDFTriple.Expand = true; base.RDFTriple.ShowDetails = true; base.GetDataByURI();//This will reset the data to a Network. // Profiles OpenSocial Extension by UCSF uri = this.BaseData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", base.Namespaces).Value; uri = uri.Substring(0, uri.IndexOf(Convert.ToString(this.SubjectID)) + Convert.ToString(this.SubjectID).Length); appId = Convert.ToInt32(base.GetModuleParamString("AppId")); om = OpenSocialManager.GetOpenSocialManager(uri, Page, true); if (om.IsEnabled()) { gadget = om.AddOntologyGadget(appId, base.GetModuleParamString("View"), base.GetModuleParamString("OptParams")); } securityOptions.Subject = this.SubjectID; securityOptions.PredicateURI = this.PredicateURI; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); hasGadget = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@NumberOfConnections").Value) > 0; }
public void DrawProfilesModule() { Profiles.Profile.Utilities.DataIO data = new Profiles.Profile.Utilities.DataIO(); if (Request.QueryString["Subject"] == null) return; base.RDFTriple = new RDFTriple(Convert.ToInt64(Request.QueryString["Subject"])); dlGoogleMapLinks.DataSource = data.GetGoogleMapZoomLinks(); dlGoogleMapLinks.DataBind(); SqlDataReader reader = null; SqlDataReader reader2 = null; Profiles.Framework.Utilities.SessionManagement session = new SessionManagement(); GoogleMapHelper gmh = new GoogleMapHelper(); try { if (base.GetModuleParamString("MapType") == "CoAuthor") { reader = data.GetGMapUserCoAuthors(base.RDFTriple.Subject, 0, session.Session().SessionID); reader2 = data.GetGMapUserCoAuthors(base.RDFTriple.Subject, 1, session.Session().SessionID); } if (base.GetModuleParamString("MapType") == "SimilarTo") { reader = data.GetGMapUserSimilarPeople(base.RDFTriple.Subject, false, session.Session().SessionID); reader2 = data.GetGMapUserSimilarPeople(base.RDFTriple.Subject, true, session.Session().SessionID); } litGoogleCode.Text = gmh.MapPlotPeople(base.RDFTriple.Subject, reader, reader2); } finally { if (!reader.IsClosed) reader.Close(); if (!reader2.IsClosed) reader2.Close(); } }
public Int64 GetSessionSecurityGroup() { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SessionManagement sm = new SessionManagement(); SqlConnection dbconnection = new SqlConnection(connstr); Int64 accesscode = 0; SqlParameter[] param; param = new SqlParameter[4]; SqlCommand dbcommand = new SqlCommand(); dbconnection.Open(); dbcommand.CommandTimeout = this.GetCommandTimeout(); param[0] = new SqlParameter("@SessionID", sm.Session().SessionID); param[1] = new SqlParameter("@securitygroupid", 0); param[1].Direction = ParameterDirection.Output; param[2] = new SqlParameter("@hasspecialviewaccess", 0); param[2].Direction = ParameterDirection.Output; param[3] = new SqlParameter("@hasspecialeditaccess", 0); param[3].Direction = ParameterDirection.Output; dbcommand.Connection = dbconnection; try { //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value. ExecuteSQLDataCommand(GetDBCommand(ref dbconnection, "[RDF.Security].[GetSessionSecurityGroup]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param)); } catch (Exception ex) { Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace); } dbcommand.Connection.Close(); if (param[1] != null) { accesscode = Convert.ToInt64(param[1].Value); } return(accesscode); }
public string GetProperty(Int64 predicateId) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlDataReader reader = null; string property = null; try { dbconnection.Open(); //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value. reader = GetDBCommand(dbconnection, "select Property FROM [Ontology.].[ClassProperty] where Class = 'http://xmlns.com/foaf/0.1/Person' and _PropertyNode = " + predicateId.ToString(), CommandType.Text, CommandBehavior.CloseConnection, null).ExecuteReader(); while (reader.Read()) { property = reader[0].ToString(); } } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } if (dbconnection.State != ConnectionState.Closed) { dbconnection.Close(); } } return(property); }
public CustomEditAuthorInAuthorship(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO(); this._subject = Convert.ToInt64(Request.QueryString["subject"]); this._predicateuri = Request.QueryString["predicateuri"].Replace("!", "#"); this._personId = data.GetPersonID(_subject); Session["NodeID"] = this._subject; Session["SessionID"] = sm.Session().SessionID; this.PropertyListXML = data.GetPropertyList(pagedata, base.PresentationXML, this._predicateuri, false, true, false); securityOptions.Subject = this._subject; securityOptions.PredicateURI = this._predicateuri; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); }
public bool IsGroupAdmin(int UserID) { SessionManagement sm = new SessionManagement(); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlDataReader reader = null; int property = 0; try { dbconnection.Open(); //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value. reader = GetDBCommand(dbconnection, "select Count(*) from [Profile.Data].[Group.Admin] where UserID = " + UserID, CommandType.Text, CommandBehavior.CloseConnection, null).ExecuteReader(); while (reader.Read()) { property = reader.GetInt32(0); } } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } if (dbconnection.State != ConnectionState.Closed) { dbconnection.Close(); } } return(property > 0); }
public List<GenericListItem> GetDepartments() { SqlDataReader dbreader = null; SessionManagement sm = new SessionManagement(); List<GenericListItem> departments = new List<GenericListItem>(); try { string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); dbconnection.Open(); SqlCommand dbcommand = new SqlCommand(); dbcommand.CommandType = CommandType.Text; dbcommand.CommandText = "select distinct department from [User.Account].[User] where isnull(department,'')<>'' and CanBeProxy = 1 and isActive = 1 order by department"; dbcommand.CommandTimeout = base.GetCommandTimeout(); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); while (dbreader.Read()) departments.Add(new GenericListItem(dbreader["department"].ToString(), dbreader["department"].ToString())); //Always close your readers if (!dbreader.IsClosed) dbreader.Close(); } catch (Exception e) { throw new Exception(e.Message); } return departments; }
public CustomEditAuthorInAuthorship(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces) : base(pagedata, moduleparams, pagenamespaces) { SessionManagement sm = new SessionManagement(); Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO(); propdata = new Profiles.Profile.Utilities.DataIO(); this._subject = Convert.ToInt64(Request.QueryString["subject"]); this._predicateuri = Request.QueryString["predicateuri"].Replace("!", "#"); this._personId = data.GetPersonID(_subject); Session["NodeID"] = this._subject; Session["SessionID"] = sm.Session().SessionID; this.PropertyListXML = propdata.GetPropertyList(pagedata, base.PresentationXML, this._predicateuri, false, true, false); //Quick fix to allow only Admin and Curators to edit Visibility privacy securityOptions.userRole = propdata.GetUserRole(sm.Session().SessionID); if (securityOptions.userRole == -40 || securityOptions.userRole == -50) { securityOptions.FindControl("imbSecurityOptions").Visible = true; securityOptions.FindControl("lbSecurityOptions").Visible = true; } else { securityOptions.FindControl("imbSecurityOptions").Visible = false; securityOptions.FindControl("lbSecurityOptions").Visible = false; } securityOptions.Subject = this._subject; securityOptions.PredicateURI = this._predicateuri; securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value); securityOptions.SecurityGroups = new XmlDataDocument(); securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml); securityOptions.BubbleClick += SecurityDisplayed; }
protected void Page_Init(object sender, EventArgs e) { sm = new SessionManagement(); DrawProfilesModule(); }
//*************************************************************************************************************************************** private void ProcessRequest() { Framework.Utilities.DebugLogging.Log("{REST.aspx.cs} ProcessRequest() start "); string param0 = string.Empty; //Application Name {default for this install is profile} string param1 = string.Empty; string param2 = string.Empty; string param3 = string.Empty; string param4 = string.Empty; string param5 = string.Empty; string param6 = string.Empty; string param7 = string.Empty; string param8 = string.Empty; string param9 = string.Empty; XmlDocument frameworkurl = new XmlDocument(); if (HttpContext.Current.Items["Param0"] != null) { param0 = HttpContext.Current.Items["Param0"].ToString(); } else { } if (HttpContext.Current.Items["Param1"] != null) { param1 = HttpContext.Current.Items["Param1"].ToString(); } else { } if (HttpContext.Current.Items["Param2"] != null) { param2 = HttpContext.Current.Items["Param2"].ToString(); } else { } if (HttpContext.Current.Items["Param3"] != null) { param3 = HttpContext.Current.Items["Param3"].ToString(); } else { } if (HttpContext.Current.Items["Param4"] != null) { param4 = HttpContext.Current.Items["Param4"].ToString(); } else { } if (HttpContext.Current.Items["Param5"] != null) { param5 = HttpContext.Current.Items["Param5"].ToString(); } else { } if (HttpContext.Current.Items["Param6"] != null) { param6 = HttpContext.Current.Items["Param6"].ToString(); } else { } if (HttpContext.Current.Items["Param7"] != null) { param7 = HttpContext.Current.Items["Param7"].ToString(); } else { } if (HttpContext.Current.Items["Param8"] != null) { param8 = HttpContext.Current.Items["Param8"].ToString(); } else { } if (HttpContext.Current.Items["Param9"] != null) { param9 = HttpContext.Current.Items["Param9"].ToString(); } else { } DataIO data = new DataIO(); //Alias.aspx is the hub for maintaining session state. With the exception of a log in Function. //the Framework.Session is created and loaded into memory at the point a user session is created in the Global.asax file. //When a session has expired the Framework.Session.SessionLogout() method is called. SessionManagement sessionmanagement = new SessionManagement(); Session session = sessionmanagement.Session(); URLResolve resolve = data.GetResolvedURL(param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, session.SessionID, Root.Domain + Root.AbsolutePath, session.UserAgent, getBestAcceptType(HttpContext.Current.Request.AcceptTypes)); Framework.Utilities.DebugLogging.Log("{REST.aspx.cs} ProcessRequest() redirect=" + resolve.Redirect.ToString() + " to=>" + resolve.ResponseURL); if (resolve.Resolved && !resolve.Redirect) { string URL = resolve.ResponseURL; Server.Execute(HttpUtility.HtmlDecode(URL)); } else if (resolve.Resolved && resolve.Redirect) { Response.Redirect(resolve.ResponseURL, true); } else { Response.Redirect(Root.Domain + "/search", true); //Response.Write("<b>Debug 404-- Your URL does not match a known Profiles RESTful pattern ---</b><br/><br/> "); //Response.Write("<br/>0: "); //Response.Write(param0); //Response.Write("<br/>1: "); //Response.Write(param1); //Response.Write("<br/>2: "); //Response.Write(param2); //Response.Write("<br/>3: "); //Response.Write(param3); //Response.Write("<br/>4: "); //Response.Write(param4); //Response.Write("<br/>5: "); //Response.Write(param5); //Response.Write("<br/>6: "); //Response.Write(param6); //Response.Write("<br/>7: "); //Response.Write(param7); //Response.Write("<br/>8: "); //Response.Write(param8); //Response.Write("<br/>9: "); //Response.Write(param9); //Response.Write("<br/><br/>Domain: "); //Response.Write(Root.Domain); //throw new Exception("custom 404 needed here"); } Framework.Utilities.DebugLogging.Log("{REST.aspx.cs} ProcessRequest() end "); }
private OpenSocialManager(string ownerUri, Page page, bool editMode) { this.guid = Guid.NewGuid(); this.isDebug = page.Session != null && page.Session[OPENSOCIAL_DEBUG] != null && (bool)page.Session[OPENSOCIAL_DEBUG]; this.noCache = page.Session != null && page.Session[OPENSOCIAL_NOCACHE] != null && (bool)page.Session[OPENSOCIAL_NOCACHE]; this.page = page; this.pageName = page.AppRelativeVirtualPath.Substring(2).ToLower(); DebugLogging.Log("Creating OpenSocialManager for " + ownerUri + ", " + pageName); if (shindigURL == null) { // do nothing return; } this.ownerUri = ownerUri; // in editMode we need to set the viewer to be the same as the owner // otherwise, the gadget will not be able to save appData correctly if (editMode) { viewerUri = ownerUri; } else { Profiles.Framework.Utilities.SessionManagement sm = new Profiles.Framework.Utilities.SessionManagement(); viewerUri = sm.Session().PersonURI; if (viewerUri != null && viewerUri.Trim().Length == 0) { viewerUri = null; } } string requestAppId = page.Request.QueryString["appId"]; DebugLogging.Log("OpenSocialManager GetAllDBGadgets " + !noCache); Dictionary <string, GadgetSpec> allDBGadgets = GetAllDBGadgets(!noCache); // if someone used the sandbox to log in, grab those gadgets refreshed from the DB if (page.Session != null && (string)page.Session[OPENSOCIAL_GADGETS] != null) { gadgets = GetSandboxGadgets(allDBGadgets, requestAppId); } else { DebugLogging.Log("OpenSocialManager GetSecurityToken " + !noCache); foreach (GadgetSpec gadgetSpec in allDBGadgets.Values) { // only add ones that are visible in this context! int moduleId = 0; if (((requestAppId == null && gadgetSpec.IsEnabled()) || gadgetSpec.GetAppId() == Convert.ToInt32(requestAppId)) && gadgetSpec.Show(viewerUri, ownerUri, GetPageName())) { String securityToken = SocketSendReceive(viewerUri, ownerUri, gadgetSpec.GetGadgetURL()); gadgets.Add(new PreparedGadget(gadgetSpec, this, moduleId++, securityToken)); } } } // if we are in edit mode, clear the cache if (editMode) { ClearOwnerCache(); } // sort the gadgets DebugLogging.Log("Visible Gadget Count : " + gadgets.Count); gadgets.Sort(); }
protected void Page_Load(object sender, EventArgs e) { sm = new SessionManagement(); if (sm.Session().UserID == 0) Response.Redirect(Root.Domain + "/search"); // UCSF DrawProfilesModule(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["method"].ToString() == "logout") { sm.SessionLogout(); sm.SessionDestroy(); Response.Redirect(Request.QueryString["redirectto"].ToString()); } else if (Request.QueryString["method"].ToString() == "shibboleth") { // added by Eric // If they specify an Idp, then check that they logged in from the configured IDP bool authenticated = false; if (ConfigurationManager.AppSettings["Shibboleth.ShibIdentityProvider"] == null || ConfigurationManager.AppSettings["Shibboleth.ShibIdentityProvider"].ToString().Equals(Request.Headers.Get("ShibIdentityProvider").ToString(), StringComparison.InvariantCultureIgnoreCase)) { String userName = Request.Headers.Get(ConfigurationManager.AppSettings["Shibboleth.UserNameHeader"].ToString()); //"025693078"; if (userName != null && userName.Trim().Length > 0) { Profiles.Login.Utilities.DataIO data = new Profiles.Login.Utilities.DataIO(); Profiles.Login.Utilities.User user = new Profiles.Login.Utilities.User(); user.UserName = userName; if (data.UserLoginExternal(ref user)) { authenticated = true; RedirectAuthenticatedUser(); } } } if (!authenticated) { // try and just put their name in the session. //sm.Session().ShortDisplayName = Request.Headers.Get("ShibdisplayName"); RedirectAuthenticatedUser(); } } else if (Request.QueryString["method"].ToString() == "login") { // see if they already have a login session, if so don't send them to shibboleth Profiles.Framework.Utilities.SessionManagement sm = new Profiles.Framework.Utilities.SessionManagement(); String viewerId = sm.Session().PersonURI; if (viewerId != null && viewerId.Trim().Length > 0) { RedirectAuthenticatedUser(); } else { string redirect = Root.Domain + "/login/default.aspx?method=shibboleth"; if (Request.QueryString["redirectto"] == null && Request.QueryString["edit"] == "true") { redirect += "&edit=true"; } else { redirect += "&redirectto=" + Request.QueryString["redirectto"].ToString(); } Response.Redirect(ConfigurationManager.AppSettings["Shibboleth.LoginURL"].ToString().Trim() + HttpUtility.UrlEncode(redirect)); } } } }
private void ActivityLog(long subjectID, int personId, string property, long propertyID, string privacyCode, string param1, string param2) { int userId = new SessionManagement().Session().UserID; int i = 1; string message = null; do { StackFrame frame = new StackFrame(i++); MethodBase method = frame.GetMethod(); message = String.Format("{0}.{1}", method.DeclaringType.FullName, method.Name); } while (message.IndexOf("ActivityLog") != -1); // lookup //Console.WriteLine(message); List <SqlParameter> param = new List <SqlParameter>(); if (userId > 0) { param.Add(new SqlParameter("@userId", userId)); } else { param.Add(new SqlParameter("@userId", DBNull.Value)); } if (personId > 0) { param.Add(new SqlParameter("@personId", personId)); } else { param.Add(new SqlParameter("@personId", DBNull.Value)); param.Add(new SqlParameter("@subjectId", subjectID)); } param.Add(new SqlParameter("@methodName", message)); if (property != null) { param.Add(new SqlParameter("@property", property)); } else { param.Add(new SqlParameter("@property", DBNull.Value)); } if (propertyID > 0) { param.Add(new SqlParameter("@propertyID", propertyID)); } if (privacyCode != null) { param.Add(new SqlParameter("@privacyCode", Convert.ToInt32(privacyCode))); } else { param.Add(new SqlParameter("@privacyCode", DBNull.Value)); } if (param1 != null) { param.Add(new SqlParameter("@param1", param1)); } else { param.Add(new SqlParameter("@param1", DBNull.Value)); } if (param2 != null) { param.Add(new SqlParameter("@param2", param2)); } else { param.Add(new SqlParameter("@param2", DBNull.Value)); } using (SqlCommand comm = GetDBCommand("", "[Framework.].[Log.AddActivity]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param.ToArray())) { ExecuteSQLDataCommand(comm); } }
/// <summary> /// Used to create a custom Profiles Session instance. This instance is used to track and store user activity as a form of Profiles Network. /// </summary> /// <param name="session">ref of Framework.Session object that stores the state of a Profiles user session</param> public void SessionUpdate(ref Session session) { string connstr = this.GetConnectionString(); SessionManagement sm = new SessionManagement(); SqlConnection dbconnection = new SqlConnection(connstr); SqlParameter[] param; param = new SqlParameter[8]; SqlCommand dbcommand = new SqlCommand(); dbconnection.Open(); dbcommand.CommandTimeout = this.GetCommandTimeout(); param[0] = new SqlParameter("@SessionID", session.SessionID); param[1] = new SqlParameter("@UserID", session.UserID); param[2] = new SqlParameter("@LastUsedDate", session.LastUsedDate); param[3] = new SqlParameter("@SessionPersonNodeID", 0); param[3].Direction = ParameterDirection.Output; param[4] = new SqlParameter("@SessionPersonURI", SqlDbType.VarChar, 400); param[4].Direction = ParameterDirection.Output; // UCSF param[5] = new SqlParameter("@UserURI", SqlDbType.VarChar, 400); param[5].Direction = ParameterDirection.Output; // UCSF param[6] = new SqlParameter("@ShortDisplayName", SqlDbType.VarChar, 400); param[6].Direction = ParameterDirection.Output; if (session.LogoutDate > DateTime.Now.AddDays(-5)) { param[7] = new SqlParameter("@LogoutDate", session.LogoutDate.ToString()); } dbcommand.Connection = dbconnection; try { //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value. ExecuteSQLDataCommand(GetDBCommand(ref dbconnection, "[User.Session].[UpdateSession]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param)); } catch (Exception ex) { Framework.Utilities.DebugLogging.Log("ERROR" + ex.StackTrace); } try { dbcommand.Connection.Close(); if (param[3].Value != null && param[3].Value != DBNull.Value) { session.NodeID = Convert.ToInt64(param[3].Value); } if (param[4].Value != null && param[4].Value != DBNull.Value) { session.PersonURI = param[4].Value.ToString(); } session.UserURI = param[5].Value.ToString(); session.ShortDisplayName = param[6].Value.ToString(); } catch (Exception ex) { Framework.Utilities.DebugLogging.Log("ERROR" + ex.StackTrace); } }
public XmlDocument GetPropertyRangeList(string propertyuri) { string xmlstr = string.Empty; XmlDocument xmlrtn = new XmlDocument(); string key = propertyuri; SessionManagement sm = new SessionManagement(); if (Framework.Utilities.Cache.Fetch(key) == null) { try { Framework.Utilities.DebugLogging.Log("{CLOUD} DATA BASE start GetPropertyRangeList(propertyuri)"); string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString; SqlConnection dbconnection = new SqlConnection(connstr); SqlCommand dbcommand = new SqlCommand(); SqlDataReader dbreader; dbconnection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.CommandTimeout = this.GetCommandTimeout(); dbcommand.CommandText = "[rdf.].getpropertyrangelist"; dbcommand.Parameters.Add(new SqlParameter("@PropertyURI", propertyuri)); dbcommand.Connection = dbconnection; dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection); Framework.Utilities.DebugLogging.Log("{CLOUD} DATA BASE end GetPresentationData(rdf, presentation)"); while (dbreader.Read()) { xmlstr += dbreader[0].ToString(); } if (!dbreader.IsClosed) { dbreader.Close(); } xmlrtn.LoadXml(xmlstr); Framework.Utilities.Cache.Set(key, xmlrtn); xmlstr = string.Empty; } catch (Exception e) { Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace); throw new Exception(e.Message); } } else { Framework.Utilities.DebugLogging.Log("{CLOUD} CACHE start GetPresentationData(rdf, presentation)"); xmlrtn = Framework.Utilities.Cache.Fetch(key); Framework.Utilities.DebugLogging.Log("{CLOUD} CACHE end GetPresentationData(rdf, presentation)"); } return(xmlrtn); }
protected override void OnInit(EventArgs e) { SessionManagement session = new SessionManagement(); masterpage = (Framework.Template)base.Master; this.Master = masterpage; this.LoadAssets(); if (Request.QueryString["subject"] != null) { this.RDFTriple = new RDFTriple(Convert.ToInt64(Request.QueryString["subject"])); this.RDFTriple.Edit = true; this.RDFTriple.Predicate = 0; this.RDFTriple.Expand = false; this.RDFTriple.Object = 0; this.RDFTriple.ShowDetails = true; session.RDFTriple = this.RDFTriple; session.ClearEditSession(); } else { this.RDFTriple = session.RDFTriple; } this.LoadPageData(); if (this.PresentationXML.SelectSingleNode("Presentation/PageOptions[@CanEdit='true']") == null) Response.Redirect(Root.Domain + "/search"); //masterpage.Tab = base.Tab; masterpage.RDFData = this.RDFData; masterpage.RDFNamespaces = this.RDFNamespaces; masterpage.PresentationXML = this.PresentationXML; }
protected void ProcessPresentationXML() { string buffer = string.Empty; SessionManagement sm = new SessionManagement(); // PageTitle buffer = GetStringFromPresentationXML("Presentation/PageTitle"); string PresentationClass = GetStringFromPresentationXML("//Presentation/@PresentationClass").ToLower(); if ((PresentationClass == "profile") || (PresentationClass == "network") || (PresentationClass == "connection")) { if (buffer == String.Empty) { buffer = PresentationClass.Substring(0, 1).ToUpper() + PresentationClass.Substring(1, PresentationClass.Length - 1); } // UCSF schema.org hack if (PresentationClass == "profile") { buffer = "<span itemprop=\"name\">" + buffer + "</span>"; } litPageTitle.Text = "<h2><a><img class=\"pageIcon\" src=\"" + Root.Domain + "/Framework/Images/icon_" + PresentationClass + ".gif\"/></a>" + buffer + "</h2>"; } // PageSubTitle buffer = GetStringFromPresentationXML("Presentation/PageSubTitle"); if (buffer != String.Empty) { litPageSubTitle.Text = "<h3>" + buffer + "</h3>"; } // PageDescription buffer = GetStringFromPresentationXML("Presentation/PageDescription"); if (buffer != String.Empty) { litPageDescription.Text = "<p>" + buffer + "</p>"; } // PageBackLink string PageBackLinkURL = GetStringFromPresentationXML("Presentation/PageBackLinkURL"); string PageBackLinkName = GetStringFromPresentationXML("Presentation/PageBackLinkName"); if ((PageBackLinkURL != String.Empty) & (PageBackLinkName != String.Empty)) { string url = string.Empty; if (PageBackLinkURL.Contains("~/")) url = Root.Domain + "/" + PageBackLinkURL.Replace("~/", ""); else if (PageBackLinkURL.Contains("~")) url = Root.Domain + PageBackLinkURL.Replace("~", ""); else url = PageBackLinkURL; litBackLink.Text = "<img src=\"" + Root.Domain + "/Framework/Images/icon_squareArrow.gif\" class=\"pageBackLinkIcon\" /> <a href=\"" + url + "\">" + PageBackLinkName + "</a>"; } // Window Title buffer = GetStringFromPresentationXML("Presentation/WindowName"); if (buffer != String.Empty) { buffer = buffer + " | "; } Page.Header.Title = buffer + "UCSF Profiles"; }
private OpenSocialManager(string ownerUri, Page page, bool editMode) { this.guid = Guid.NewGuid(); this.isDebug = page.Session != null && page.Session[ORNG_DEBUG] != null && (bool)page.Session[ORNG_DEBUG]; this.noCache = page.Session != null && page.Session[ORNG_NOCACHE] != null && (bool)page.Session[ORNG_NOCACHE]; this.page = page; this.pageName = page.AppRelativeVirtualPath.Substring(2).ToLower(); DebugLogging.Log("Creating OpenSocialManager for " + ownerUri + ", " + pageName); if (shindigURL == null) { // do nothing return; } this.ownerUri = ownerUri; // in editMode we need to set the viewer to be the same as the owner // otherwise, the gadget will not be able to save appData correctly if (editMode) { viewerUri = ownerUri; } else { Profiles.Framework.Utilities.SessionManagement sm = new Profiles.Framework.Utilities.SessionManagement(); // if they have a Profile, use the Profile URI otherwise use the User URI. This allows admins and other folks without profile pages to use gadgets if (sm.Session().PersonURI != null && sm.Session().PersonURI.Trim().Length > 0) { viewerUri = sm.Session().PersonURI; } else { viewerUri = sm.Session().UserURI; } if (viewerUri != null && viewerUri.Trim().Length == 0) { viewerUri = null; } } string requestAppId = page.Request.QueryString["appId"]; foreach (GadgetSpec gadgetSpec in GetGadgetSpecifications()) { // only add ones that are visible in this context! if (((requestAppId == null && gadgetSpec.IsEnabled()) || gadgetSpec.GetAppId() == Convert.ToInt32(requestAppId)) && gadgetSpec.Show(viewerUri, ownerUri, GetPageName())) { gadgets.Add(new PreparedGadget(gadgetSpec, this)); } } // if we are in edit mode, clear the cache if (editMode) { ClearOwnerCache(); } // sort the gadgets DebugLogging.Log("Visible Gadget Count : " + gadgets.Count); gadgets.Sort(); }