MODX Community

Access denied when executing processor system/settings/update

Hi,

I wrote a script to update some settings on multiple instances of MIodX.
My script is on the same server and can access to the ModX core.
I can initialize ModX and receive correct information for some method/command like getting current user or the whole user list.

But the processor to update some settings return an error.

An idea?

My pseudo code:

require_once (INSTALLFOLDER.$install['folder'].'/config.core.php');
require_once (MODX_CORE_PATH.'model/modx/modx.class.php');
$modx = new modX();
$modx->initialize('mgr');
$modx->getService('error','error.modError', '', '');

if($modx)
{
$s= array(	"key"=> "login_text",
			"value"=> "Login with My Account",
			"namespace"=>"shibboleth",
		);			
$processor = "system/settings/update";
    $options = array();
    $result = $modx->runProcessor($processor, $s, $options);
    if (method_exists($result,"isError"))
    {
	    if($result->isError())
	    {
		echo  "Unable to update ".$s['key'].": ".$s['value']."\n";
		echo "Error: ".$result->getMessage();
	    } else {
		echo 'all done';
	    }	
    }
}

Thank you

What’s the error message? You can check the error message(s) using $result->getAllErrors().

Hi Joshua, the error is
[
“permission_denied”
]

An idea?

Hi,

When I use the deprecated syntax, it works fine.

So I will use the deprecated syntax:

define('MODX_API_MODE', true);
require_once(INSTALLFOLDER.$install['folder'].'/index.php');
$modx = new modX();
$modx->initialize('mgr');