public void CreateAccountWebsiteAccrossAccounts() { ManagedAccount a = new ManagedAccount(Session); ManagedAccount b = new ManagedAccount(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); b.Create("Test User 2", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); TransitAccountWebsite ta = new TransitAccountWebsite(); ta.Name = "My Website"; ta.Description = "Lots of details."; ta.Url = "http://www.dblock.org"; ManagedAccountWebsite m_a = new ManagedAccountWebsite(Session); m_a.CreateOrUpdate(ta, a.GetSecurityContext()); ManagedAccountWebsite m_b = new ManagedAccountWebsite(Session); m_b.CreateOrUpdate(ta, b.GetSecurityContext()); } finally { a.Delete(a.GetSecurityContext()); b.Delete(b.GetSecurityContext()); } }
public void CreateAccountWebsiteInvalid() { ManagedAccount a = new ManagedAccount(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); TransitAccountWebsite ta = new TransitAccountWebsite(); ta.Name = "My Website"; ta.Description = "Lots of details."; ta.Url = "<script>attack!</script>"; ManagedAccountWebsite m_w = new ManagedAccountWebsite(Session); m_w.CreateOrUpdate(ta, a.GetSecurityContext()); } finally { a.Delete(AdminSecurityContext); } }
private void RunThumbnail(ISession session, AccountWebsite website, ManagedSecurityContext sec) { try { ManagedAccountWebsite m_website = new ManagedAccountWebsite(session, website); if (IsDebug) { EventLogManager.WriteEntry(string.Format("Thumbnail service updating {0}: {1}, {2}", website.Id, website.Name, website.Url), EventLogEntryType.Information); } m_website.UpdateThumbnail(); } catch (ThreadAbortException) { throw; } catch (Exception) { website.Modified = DateTime.UtcNow; session.Save(website); } }