Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • GrantWright 1 post 71 karma points
    Dec 12, 2015 @ 12:13
    GrantWright
    0

    Limiting users to be able only to delete their own posts

    Is that possible in Umbraco out-of-the-box? Or do I need to extend it in some way?

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Dec 12, 2015 @ 21:25
    Nicholas Westby
    0

    That's not offered OOTB AFAIK. However, you could listen for node saving events, check if the node is new (e.g., by checking if HasIdentity is false), and if so then assign the user saving that node permission to delete the node.

    You can see how to listen for content saving events here: https://our.umbraco.org/documentation/Reference/Events/ContentService-Events

    You can use something like this to assign delete permission for a given content node:

    ApplicationContext.Current.Services.ContentService
        .AssignContentPermission(node, permissionChar, new[] { userId });
    

    I don't know off the top of my head the correct character for delete permission.

  • Ian 178 posts 752 karma points
    Dec 15, 2015 @ 14:49
    Ian
    0

    Hi there, I looked at this earlier but my train of thought was to add in a custom action into the content tree where you can apply logic which apples the restrictions you want. Looking through the source I couldn't figure out how you would do that, so didn't want to waste your time.

    Now I'm just looking at creating a section and came across this https://our.umbraco.org/wiki/reference/backoffice-apis/tree-api-to-create-custom-treesapplications/ which suggests how you might get such an action into the content tree.

    If Nicholas's solution works perfectly well for you that does sound like a lot less work, then this link does at least provide details of what the character for the delete action should be.

Please Sign in or register to post replies

Write your reply to:

Draft