From f65e880aaafc51df659d42d7085f252b7ecc692f Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 24 Jul 2015 15:30:09 +0200 Subject: [PATCH] Sync: forbid sync access to existing templates --- library/Director/Import/Sync.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/library/Director/Import/Sync.php b/library/Director/Import/Sync.php index 4b418415..752560e5 100644 --- a/library/Director/Import/Sync.php +++ b/library/Director/Import/Sync.php @@ -130,6 +130,19 @@ class Sync $dba = $db->getDbAdapter(); $dba->beginTransaction(); foreach ($objects as $object) { + if ($object->isTemplate()) { + if ($object->hasBeenModified()) { + throw new \Exception( + sprintf( + 'Sync is not allowed to modify template "%s"', + $object->object_name + ) + ); + } + + continue; + } + if ($object->hasBeenLoadedFromDb() && $rule->purge_existing === 'y') { /* // TODO: Check against ALL sources