コード例 #1
0
        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());
            }
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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);
            }
        }