We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Just as I was configuring the manager for a client I noticed a "gap" of sorts in the permission system, which I did not notice earlier : you can’t deny access to the "Tools" item in the manager menu. I have just set up a basic editor’s role and despite limited permissions, the editor still has access to "Import" and "Export" in the Tools menu (which I’d rather they not have).

    Is there any way to hack the manager into submission (so to speak), to remove those two items ?

    Thanks !
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 30223
      • 1,010 Posts
      If you just want a quick hack, yes that’s easy, open manager/frames/menu.php and insert this at line 316:


      <?php /* start commented out ?>

      And insert this at line 122 (or 123 if you’ve inserted the above already smiley )

      <?php //end commented out */ ?>

      that’ll do the trick (the dirty way). Offcourse nobody will have access to those menus anymore until you uncomment them smiley

      Wondering why I used quotes instead of code? Try placing this in bbcode code block <?php /* start commented out ?>. All you’ll see is the php start tag... huh

      <?php /* start commented out ?>


      EDIT Ehm,.. the line numbers are for the latest version from svn, they may differ for other versions.
        • 25663 MODX Staff
        • 12,272 Posts
        This may be a candidate for a permissions review.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 6726
          • 7,075 Posts
          Thanks for the quick and dirty fix TobyL smiley
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 6726
            • 7,075 Posts
            Now that I have dug into this a bit more, I think rather than commenting I’ll tweak permissions this way :

            Change line 316 to 320 :

            <?php if($modx->hasPermission('new_document')) { ?>
            <!--import-html--><li><a onclick="this.blur();" href="index.php?a=95" target="main"><?php echo $_lang["import_site"]; ?></a></li>
            <?php } ?>
            <?php if($modx->hasPermission('edit_document')) { ?>
            <!--export-static-site--><li><a onclick="this.blur();" href="index.php?a=83" target="main"><?php echo $_lang["export_site"]; ?></a></li>
            


            Into

            <?php if($modx->hasPermission('settings')) { ?>
            <!--import-html--><li><a onclick="this.blur();" href="index.php?a=95" target="main"><?php echo $_lang["import_site"]; ?></a></li>
            <?php } ?>
            <?php if($modx->hasPermission('settings')) { ?>
            <!--export-static-site--><li><a onclick="this.blur();" href="index.php?a=83" target="main"><?php echo $_lang["export_site"]; ?></a></li>
            


            Importing and exporting html is not trivial, and should remain a privilege of the website admin, IMHO.
            Now if you think of a more appropriate permission, please tell me !

            Just logged this into FlySpray :
            http://modxcms.com/bugs/task/599
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 22815
              • 1,097 Posts
              Your permissions tweak only affects the display of the link, and it is still possible for users to visit index.php?a=95 or index.php?a=83 to import or export the site. Thus this isn’t actually any more secure than commenting, it’s just more convenient for admin users who will still see the links.

              If the decision is made to restrict these features to People Who Can Mess With Settings, then the routines themselves will need amending too.

              For the record, I’m in favour of two extra permissions as it’s the cleanest and most straight-forward.
                No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                Forum: Where to post threads about add-ons | Forum Rules
                Like MODx? donate (and/or share your resources)
                Like me? See my Amazon wishlist
                MODx "Most Promising CMS" - so appropriate!
                • 6726
                • 7,075 Posts
                No no it’s no more secure than commenting, for sure, but at least I still have those items handy when I am logged in as admin.

                I needed a quick and dirty fix there, and the users in my case won’t be able to mess with settings...
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id
                  • 6726
                  • 7,075 Posts
                  Quick note : If you need to do the same thing, don’t forget to also edit welcome.static.php

                  Line 35, remove the ’exec-module’ permission...

                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id