Copied to clipboard

Flag this post as spam?

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


  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 20, 2009 @ 21:22
    Lee Kelleher
    0

    Restrict User to Not Delete Members

    Hi all!

    I have a good understanding how the permissions work in the Users section, which are fine for the Content & Media sections.

    Is there a way of restricting a (back-end) user to only the Members section (just tick the box in the 'sections' panel) and only have permission to create & edit, but not delete any of the members?

    Reason for this is that we've got a couple of freelancers manually importing data (it's a long story) - so don't want anything to go wrong, (yep, we've taken DB back-ups, etc beforehand) ;-P

    Many thanks, Lee

  • skiltz 501 posts 701 karma points
    Oct 20, 2009 @ 22:28
    skiltz
    1

    You could create a Member Event handler which acts on the Member.BeforeDelete method and then returns cancel.

    Untested, not sure if this work.

     

    public class MemberCantDelete : ApplicationBase

    {

     

    public MemberCantDelete()

    {

     

    Member.BeforeDelete += new Member.DeleteEventHandler(Member_Delete);

     

    }

     

    public void Member_Delete(Member sender, DeleteEventArgs e)

    {

    e.Cancel =

    true;

    }

    }

     

  • skiltz 501 posts 701 karma points
    Oct 20, 2009 @ 22:29
    skiltz
    1

    Ohh and also and if this works it would stop anyone front deleting.  You'd need to add some more logic to test if they had permission. 

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Oct 21, 2009 @ 00:05
    Lee Kelleher
    0

    Thanks skiltz, it's a good approach, I may well just do it!  I've created a new User Type for the new users, (so they are completely locked down), I could always check which User Type the user is in the "Member_Delete" method.

    Alternatively, I recall someone mentioning manipulating the appTree recently... maybe I could hide the 'delete' context menu item from them?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Oct 21, 2009 @ 03:10
    Aaron Powell
    1

    If you wanted to change the tree you'd probably have to create a class that inherits from loadMembers and then override the AllowedActions method (I think, you'll need to double check that)

Please Sign in or register to post replies

Write your reply to:

Draft