public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.Write("results="); string searchterms = context.Request.QueryString["Field"]; string pid = context.Request.QueryString["PID"]; var factory = new vwarDAL.DataAccessFactory(); vwarDAL.IDataRepository vd = factory.CreateDataRepositorProxy(); vwarDAL.ContentObject co = vd.GetContentObjectById(pid, false); if (searchterms.Contains("UpAxis")) { context.Response.Write("UpAxis=" + co.UpAxis + ";"); } if (searchterms.Contains("UnitScale")) { context.Response.Write("UnitScale=" + co.UnitScale + ";"); } if (searchterms.Contains("NumPolygons")) { context.Response.Write("NumPolygons=" + co.NumPolygons + ";"); } if (searchterms.Contains("NumTextures")) { context.Response.Write("NumTextures=" + co.NumTextures + ";"); } if (searchterms.Contains("Label")) { context.Response.Write("Label=" + co.Label + ";"); } if (searchterms.Contains("Keywords")) { context.Response.Write("Keywords=" + co.Keywords + ";"); } context.Response.End(); }
public static void SendModelUploaded(vwarDAL.ContentObject co) { if (!System.Convert.ToBoolean(ConfigurationManager.AppSettings["EMAIL_UploadedEnabled"])) { return; } string body = ConfigurationManager.AppSettings["EMAIL_UploadedBody"]; string subject = ConfigurationManager.AppSettings["EMAIL_UploadedSubject"]; string Uploader = HttpContext.Current.User.Identity.Name; body = body.Replace("{pid}", co.PID); body = body.Replace("{username}", Uploader); body = body.Replace("{title}", co.Title); subject = subject.Replace("{pid}", co.PID); subject = subject.Replace("{username}", Uploader); subject = subject.Replace("{title}", co.Title); Website.Mail.SendSingleMessage(body, ConfigurationManager.AppSettings["SupportEmail"], subject, ConfigurationManager.AppSettings["SupportEmail"], ConfigurationManager.AppSettings["SiteName"], "", "", false, ""); }
//Do the business logic related to checking a url against the auth string, and checking if the user is allowed //to do the operation on the content object static public bool ValidateUserTransaction(string url, string auth, TransactionType type, vwarDAL.ContentObject co) { //For now, anyone can query if (type == TransactionType.Query) { return(true); } if (type == TransactionType.Access) { //No auth control for Access transactions return(true); } if (type == TransactionType.Create) { //The user exists in the provider and gave the correct url+password hash //Here we assume that any user can create content return(ValidateURL(url, GetUsernameFromHeader(auth), GetHashFromHeader(auth))); } if (type == TransactionType.Modify) { //The user exists in the provider and gave the correct url+password hash if (ValidateURL(url, GetUsernameFromHeader(auth), GetHashFromHeader(auth))) { //the user must be the owner of the content object if (Security.GetProvider().GetUser(GetUsernameFromHeader(auth), false).Email == co.SubmitterEmail || GetUsernameFromHeader(auth) == "API_USER") { return(true); } } return(false); } if (type == TransactionType.Delete) { //The user exists in the provider and gave the correct url+password hash if (ValidateURL(url, GetUsernameFromHeader(auth), GetHashFromHeader(auth))) { //the user must be the owner of the content object if (Security.GetProvider().GetUser(GetUsernameFromHeader(auth), false).Email == co.SubmitterEmail || GetUsernameFromHeader(auth) == "API_USER") { return(true); } } return(false); } return(false); }
public string InsertMetadata(Metadata md) { vwarDAL.ContentObject co = new vwarDAL.ContentObject(GetRepo()); CopyContentObjectData(md, co); GetRepo().InsertContentObject(co); ReleaseRepo(); return co.PID; }