Commit 32438bde authored by Manfred Kutas's avatar Manfred Kutas

ZP-77 Save the policies from file in zpush.php and make them available

via a getter.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 6f11779e
......@@ -949,7 +949,7 @@ class DeviceManager {
*/
private function getProvisioningPolicies() {
$policyName = $this->getPolicyName();
$policies = parse_ini_file(PROVISIONING_POLICYFILE, true);
$policies = ZPush::GetPolicies();
if (!isset($policies[$policyName]) && $policyName != ASDevice::DEFAULTPOLICYNAME) {
ZLog::Write(LOGLEVEL_WARN, sprintf("The '%s' policy is configured, but it is not available in the policies' file. Please check %s file. Loading default policy.", $policyName, PROVISIONING_POLICYFILE));
......
......@@ -191,6 +191,7 @@ class ZPush {
static private $topCollector;
static private $backend;
static private $addSyncFolders;
static private $policies;
/**
......@@ -287,8 +288,8 @@ class ZPush {
// check if Provisioning is enabled and the default policies are available
if (PROVISIONING) {
$policies = parse_ini_file(PROVISIONING_POLICYFILE, true);
if (!isset($policies['default'])) {
ZPush::$policies = parse_ini_file(PROVISIONING_POLICYFILE, true);
if (!isset(ZPush::$policies['default'])) {
throw new FatalMisconfigurationException(sprintf("Your policies' configuration file doesn't contain the required [default] section. Please check the %s file.", constant('PROVISIONING_POLICYFILE')));
}
}
......@@ -877,4 +878,13 @@ END;
return $defcapa;
}
/**
* Returns the available provisioning policies.
*
* @return array
*/
static public function GetPolicies() {
// TODO another policy providers might be available, e.g. for sqlstatemachine
return ZPush::$policies;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment