Beispiel #1
0
        public void DeleteEntry(string postid)
        {
            Entry entry = GetEntryForEdit(postid);

            dataService.DeleteEntry(postid, null);
            LogEvent(EventCodes.EntryDeleted, entry);
        }
Beispiel #2
0
        public bool blogger_deletePost(string appKey, string postid, string username, string password, [XmlRpcParameter(Description = "Where applicable, this specifies whether the blog should be republished after the post has been deleted.")] bool publish)
        {
            VerifyAccess(username, password);

            dataService.DeleteEntry(postid, null);

            return(true);
        }
Beispiel #3
0
        public void DeleteEntry(string postid)
        {
            var entry = GetEntryForEdit(postid);

            dataService.DeleteEntry(postid, null);
            // BreakCache(entry.GetSplitCategories());

            LogEvent(EventCodes.EntryDeleted, entry);
        }
Beispiel #4
0
        public bool blogger_deletePost(string appKey, string postid, string username, string password, [XmlRpcParameter(Description = "Where applicable, this specifies whether the blog should be republished after the post has been deleted.")] bool publish)
        {
            if (!dasBlogSettings.SiteConfiguration.EnableBloggerApi)
            {
                throw new ServiceDisabledException();
            }

            if (!VerifyLogin(username, password))
            {
                throw new SecurityException();
            }

            dataService.DeleteEntry(postid, null);

            return(true);
        }
Beispiel #5
0
        public void BlogDataService_GetEntryForEditDelete_Successful(IBlogDataService blogdataservice)
        {
            var entry = TestEntry.CreateEntry(String.Format("Test Entry 2"), 5, 2);

            blogdataservice.SaveEntry(entry, null);

            var dt          = DateTime.Now;
            var returnEntry = blogdataservice.GetEntryForEdit(entry.EntryId);

            Assert.NotNull(returnEntry);

            blogdataservice.DeleteEntry(entry.EntryId, null);

            var entryFailRetrieval = blogdataservice.GetEntry(entry.EntryId);

            Assert.Null(entryFailRetrieval);
        }
Beispiel #6
0
        public void BlogDataService_CreateGetDeleteEntry_Successful(IBlogDataService blogdataservice)
        {
            var entry = TestEntry.CreateEntry(String.Format("Test Entry"), 5, 2);

            blogdataservice.SaveEntry(entry, null);

            var dt          = DateTime.Now;
            var returnEntry = blogdataservice.GetEntry(entry.EntryId);

            Assert.Equal(0, entry.CompareTo(returnEntry));

            blogdataservice.DeleteEntry(entry.EntryId, null);

            var entryFailRetrieval = blogdataservice.GetEntry(entry.EntryId);

            Assert.Null(entryFailRetrieval);
        }
Beispiel #7
0
        public void BlogDataService_UpdateEntriesDelete_Successful(IBlogDataService blogdataservice)
        {
            var entry = TestEntry.CreateEntry(String.Format("Test Entry 3"), 5, 2);

            entry.Categories = "test";
            blogdataservice.SaveEntry(entry, null);

            var dt          = DateTime.Now;
            var returnEntry = blogdataservice.GetEntryForEdit(entry.EntryId);

            Assert.NotNull(returnEntry);

            returnEntry.Title = "Test Entry 4";
            var state = blogdataservice.SaveEntry(returnEntry, null);

            Assert.True(state == EntrySaveState.Updated);

            var entryAfterUpdate = blogdataservice.GetEntry(entry.EntryId);

            Assert.True(entryAfterUpdate.Title == "Test Entry 4");

            blogdataservice.DeleteEntry(entry.EntryId, null);
        }
Beispiel #8
0
 public void DeleteEntry(string postid)
 {
     _dataService.DeleteEntry(postid, null);
 }
Beispiel #9
0
        /// <summary>
        /// Deletes an entry, including comments enclosures etc.
        /// </summary>
        /// <remarks>Admins can delete all, contributors only their own.</remarks>
        /// <param name="entryId">The entry to delete.</param>
        /// <param name="siteConfig"></param>
        /// <param name="logService"></param>
        /// <param name="dataService"></param>
        public static void DeleteEntry(string entryId, SiteConfig siteConfig, ILoggingDataService logService, IBlogDataService dataService)
        {
            try
            {
                IPrincipal user = HttpContext.Current.User;
                Entry entry = dataService.GetEntry(entryId);
                //fix: admins can delete all, contributors only their own
                if (!CanEdit(user, entry))
                {
                    throw new SecurityException("Current user is not allowed to delete this entry!");
                }

                string permalink = SiteUtilities.GetPermaLinkUrl(entry.EntryId);
                //string[] categories = entry.GetSplitCategories();

                dataService.DeleteEntry(entryId, siteConfig.CrosspostSites);

                BreakCache(siteConfig, entry.GetSplitCategories());

                // give the XSS upstreamer a hint that things have changed
                //FIX:    XSSUpstreamer.TriggerUpstreaming();

                // TODO: when we add support for more than just enclosures, we can't delete the entire folder
                DirectoryInfo enclosuresPath = new DirectoryInfo((Path.Combine(SiteConfig.GetBinariesPathFromCurrentContext(), entryId)));
                if (enclosuresPath.Exists) enclosuresPath.Delete(true);

                logService.AddEvent(
                    new EventDataItem(
                    EventCodes.EntryDeleted, entry.Title,
                    permalink));
            }
            catch (SecurityException)
            {
                throw;
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                logService.AddEvent(
                    new EventDataItem(EventCodes.Error, ex.ToString() + Environment.NewLine + st.ToString(), HttpContext.Current.Request.RawUrl));

                // DESIGN: We should rethrow the exception for the calling class, but this break too much for this point release.
            }
        }