We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13481
    • 97 Posts
    Is there a way to set permissions on who can purge documents? I’d like my user to be able to mark documents as deleted, but only allow the administrator to purge deleted docs. If I give the manager user permission to delete documents they can also purge them.

    Does anyone know how to do this?

    Thanks,

    James
      • 13481
      • 97 Posts
      I still need help with this. Does anyone know if it is possible or not? huh
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Not with the current code; it would not be difficult to hack it so that only users with role 1 (default administrator) could purge, though. The action occurs in line 393 of /manager/frames/tree.php. It should be possible to insert some php code to check for the role of the user, and only output that line if he has the approved role.

        Or, alternatively, at line 436, don’t even show the button unless the user has the approved role. That would probably be a better idea.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 13481
          • 97 Posts
          Thanks Susan, that helps a ton!

          James
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Make this change at line 436
            <?php 
             // modified by sottwell 11-2007 to check for role #1
            if($_SESSION['mgrRole'] == '1') { ?>
                        <td><a href="#" id="Button10" class="treeButtonDisabled"' title="<?php echo $_lang['empty_recycle_bin_empty'] ; ?>"><?php echo $_style['empty_recycle_bin_empty'] ; ?></a></td>
            <?php }
            // end modification 
            ?>
            

            Works great.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Oooh, bad sottwell!!! There is an event, "onBeforeEmptyTrash", so there should be a plugin made to do this, instead of hacking the core! Although I don’t have a clue how to go about doing that... I could write a plugin to check for the user’s role, but then how to abort the purge?

              Besides, I prefer not to even display the button if the user can’t use the function.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org