+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / You are not allowed to move this item into the Recycle Bin

You are not allowed to move this item into the Recycle Bin

6 posts, 0 answered
  1. Rich
    Rich avatar
    24 posts
    Registered:
    22 Oct 2012
    14 Oct 2014
    Link to this post

    I'm trying to move a Dynamic Content item to the Recycle Bin in SF 7.1.5200.0, and the app is throwing an exception stating "You are not allowed to move this item into the Recycle Bin" on the call to MoveToRecycleBin() .  Here is the code I'm using.

    try
    {
        DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(String.Empty);
        Type moduleType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Vendors.Vendor");
        dynamicModuleManager.Provider.SuppressSecurityChecks = true;
     
        // Update a vendor record
        var vendor = dynamicModuleManager.GetDataItem(moduleType, masterId);
     
        dynamicModuleManager.RecycleBin.MoveToRecycleBin(vendor);
     
        dynamicModuleManager.SaveChanges();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex);
    }
    This problem occurs when a front-end user tries to execute this code.  I can move this same Dynamic item to the Recycle Bin in the back-end with no issues.  This Dynamic object has Related Items and Related Media type fields in it.  Any insight into the error message.  Is it a permissions issue?

     Also, when I'm querying Dynamic Content items should I filter by the Visible or the IsDeleted property to exclude items in the Recycle Bin?

  2. Veneta Bogoeva
    Veneta Bogoeva avatar
    19 posts
    Registered:
    29 Aug 2016
    17 Oct 2014
    Link to this post
    Hello,

    The issue occurs because your frontend user doesn’t have needed permission to execute the code.

    You could try to run the code in elevated mode like this:

    using (new ElevatedModeRegion(dynamicManager))
            {
                //your logic here
            }

    Please let us know if this work.

    Regards,
    Veneta Bogoeva
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Rich
    Rich avatar
    24 posts
    Registered:
    22 Oct 2012
    29 Oct 2014 in reply to Veneta Bogoeva
    Link to this post

    ElevatedModeRegion makes sense, but I am still getting the same "You are not allowed to move this item into the Recycle Bin" exception.  Here is my updated code.

    try
    {
        DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(String.Empty);
     
        using (new ElevatedModeRegion(dynamicModuleManager))
        {
            Type moduleType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Vendors.Vendor");
            dynamicModuleManager.Provider.SuppressSecurityChecks = true;
     
            // Update a vendor record
            var vendor = dynamicModuleManager.GetDataItem(moduleType, masterId);
     
            dynamicModuleManager.RecycleBin.MoveToRecycleBin(vendor);
     
            dynamicModuleManager.SaveChanges();
        }
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex);
    }

  4. Bobby
    Bobby avatar
    10 posts
    Registered:
    22 Nov 2016
    30 Oct 2014
    Link to this post
    Hi Richard,

    We are aware of this issue and it will be fixed for the next Sitefinity release.

    If you are not able to wait for it, we can provide you with a way to bypass the problem, but it is considered a hack and my harm your security.

    We are sorry for the inconvenience caused.

    Regards,
    Bobby
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  5. LBrinley
    LBrinley avatar
    59 posts
    Registered:
    29 Dec 2005
    13 Aug 2015 in reply to Bobby
    Link to this post
    This issue is still present in 8.0. Was it fixed in 8.1?
  6. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    02 Dec 2016
    28 Aug 2015
    Link to this post
    Hello Larry,

    I have just tested this in Sitefinity 8.1 and the issue still reproduces. I have logged it as a bug in our feedback portal on the below link. Hopefully we will provide a fix for it for our future releases.

    Anonymous users are note able to move content items to recycle bin using the API

    You can subscribe to receive notifications for the bug including new comments, votes, status changes by clicking on the Follow this item link. If you would like to unsubscribe, you can unfollow the item by clicking on the "Following this item”. Once the problem is fixed the item will be marked as Done.

    I sincerely apologize for the inconvenience caused by this issue.

    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
6 posts, 0 answered