We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27752
    • 1 Posts
    When I duplicate the Administrator policy and then try to edit it, I can make changes to the permissions, but when I go to save it, nothing gets saved. If I create a new policy, I can save permission changes, it is only when I duplicate an existing policy. Any ideas on how to fix this?

    Version: Revolution 2.0.4-pl2
    Linux Server
      • 36436
      • 28 Posts
      Same problem here on 2.1.3-pl.
      Can’t save changed Access Policies and Policy Templates or dublicates of these.

      Any solution to this?
        • 36549
        • 572 Posts
        I'm using 2.2.1 and the import/export feature doesn't work for me either.
        When i export a Content Editor access policy with 44 permissions enabled, it imports with 171!

        Any ideas appreciated as it would be a great feature if/when working.
          www.9thwave.co.uk
             WEB | DESIGN | PRINT
          • 36436
          • 28 Posts
          9thwave, I think we both came across this issue some time ago here: https://forums.modx.com/thread/31748/can-t-save-changes-on-dublicated-access-policies-and-policy-templates.
          Or am I wrong?
            • 36549
            • 572 Posts
            Webaff, yes you are right:-/
            sorry it seems i posted this in the wrong topic. My issue now is that i am unable to get the export and importing of access policies to work.
            The saving of policies works by deleting the database_truncate as the link you've posted explains.
              www.9thwave.co.uk
                 WEB | DESIGN | PRINT
              • 39333
              • 151 Posts
              9thwave,

              Did you ever find a solution to this problem? I am running into the same thing. For whatever reason an exported/imported policy list has all 171 permissions enabled even though only 34 are active on the export site. Seems the export function is picking the Administrator policy no matter which of the others is chosen.

              Whether I import the policy to the same instal or another one I get the same result. The only solution I can think of is manually editing the XML file to match the policy I am trying to save.

              Revolution 2.2.4pl
              linux host
              php and mysql 5.x.x
                MODX...the Zen of CMS
                "Bight off more than you can chew and keep right on chewing."
                • 36549
                • 572 Posts
                No, my setup is the same as yours Eric and it's never worked for me which is a bit of an annoyance because it would be a very helpful time saver.

                Anyone got this to work?
                  www.9thwave.co.uk
                     WEB | DESIGN | PRINT
                  • 39333
                  • 151 Posts
                  I am looking at the Exported XML right now. Here is the top lines from that:

                          <name>AdministratorTemplate</name>
                          <description>Context administration policy template with all permissions.</description>


                  So indeed it is doing what I mentioned which is taking the Administrator template with the Administrator policy and not the Manager policy I created and am right clicking on then choosing export.

                  Tedious as it is I'm going down through the XML and matching up the check boxes with 1s and 0s for on and off respectively to match my Manager policy. At least once it's done I'll have my main site manager list for importing. If it still doesn't work I'll post back.

                  Anyone got this to work?
                  ?
                    MODX...the Zen of CMS
                    "Bight off more than you can chew and keep right on chewing."
                    • 39333
                    • 151 Posts
                    Heck I don't know. It didn't work. Even though I went down through and tried both changing the 1's to 0s and also just removing the number for the settings I wanted turned off. I think that just changes the Admin template though and not the policy from looking over the full XML.

                    I tried doing a bunch of other edits as well like removing the template and leaving just the policy, which comes after the template in the XML, and that just errors out or won't upload.

                    Looking at the list though I'm not sure. Like I said it has the Admin template is above and the policy below. Everything looks right actually. The Admin template has all the settings turned on which would make sense and the following Manager policy has the correct ones turned off. So it should apply that policy to the admin template. It's just not making with import. Maybe it has to do with the admin template.

                    I'm going to try a few more things before giving up and go down through and turn off 140 settings manually :-(
                      MODX...the Zen of CMS
                      "Bight off more than you can chew and keep right on chewing."
                      • 3749
                      • 24,544 Posts
                      I think the Administrator Policy and Policy Template are read-only. That might explain part of your problem.

                      In any case, they should never be altered. You should always duplicate them and alter the duplicate. It sounds like you're still looking at a bug in the export process, though.

                      In theory, exporting a custom Policy would have just the set permissions set in the XML file.

                      As a workaround, you might be able to do what you want with a couple of snippets using something like this (untested):

                      <?php
                      /* Export MyPolicy */
                      
                      $policy = $modx->getObject('modPolicy', array('name' => 'MyPolicy'));
                      $fields = $policy->toArray();
                      $data = $modx->toJSON($fields);
                      $fp = fopen('mypolicy.txt', 'w');
                      fwrite($fp, $data);
                      fclose($fp);
                      


                      <?php
                      /* Import MyPolicy */
                      
                      $data = file_get_contents('mypolicy.txt');
                      $fields = $modx->fromJSON($fields);
                      unset($fields['id']);
                      $policy = $modx->newObject('modPolicy', $fields);
                      $policy->save();
                      



                      ------------------------------------------------------------------------------------------
                      PLEASE, PLEASE specify the version of MODX you are using.
                      MODX info for everyone: http://bobsguides.com/modx.html
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting