diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 1064494f..eae0c1bd 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -435,6 +435,9 @@ class LAMConfig { /** use paged results */ private $pagedResults = 'false'; + /** overlay for referential integrity is activated */ + private $referentialIntegrityOverlay = 'false'; + /** Array of string: users with admin rights */ private $Admins; @@ -589,7 +592,7 @@ class LAMConfig { 'pwdResetAllowScreenPassword', 'pwdResetForcePasswordChange', 'pwdResetDefaultPasswordOutput', 'scriptUserName', 'scriptSSHKey', 'scriptSSHKeyPassword', 'twoFactorAuthentication', 'twoFactorAuthenticationURL', 'twoFactorAuthenticationInsecure', 'twoFactorAuthenticationLabel', 'twoFactorAuthenticationOptional', - 'twoFactorAuthenticationCaption' + 'twoFactorAuthenticationCaption', 'referentialIntegrityOverlay' ); @@ -799,6 +802,7 @@ class LAMConfig { if (!in_array("useTLS", $saved)) array_push($file_array, "\n\n# enable TLS encryption\n" . "useTLS: " . $this->useTLS . "\n"); if (!in_array("followReferrals", $saved)) array_push($file_array, "\n\n# follow referrals\n" . "followReferrals: " . $this->followReferrals . "\n"); if (!in_array("pagedResults", $saved)) array_push($file_array, "\n\n# paged results\n" . "pagedResults: " . $this->pagedResults . "\n"); + if (!in_array("referentialIntegrityOverlay", $saved)) array_push($file_array, "\n" . "referentialIntegrityOverlay: " . $this->referentialIntegrityOverlay . "\n"); if (!in_array("Passwd", $saved)) array_push($file_array, "\n\n# password to change these preferences via webfrontend\n" . "Passwd: " . $this->Passwd . "\n"); if (!in_array("Admins", $saved)) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" . "# names have to be seperated by semicolons\n" . @@ -1034,6 +1038,33 @@ class LAMConfig { $this->pagedResults = $pagedResults; } + /** + * Returns if referential integrity overlay is in place. + * + * @return String true or false + */ + public function getReferentialIntegrityOverlay() { + return $this->referentialIntegrityOverlay; + } + + /** + * Sets if referential integrity overlay is in place. + * + * @param String $referentialIntegrityOverlay true or false + */ + public function setReferentialIntegrityOverlay($referentialIntegrityOverlay) { + $this->referentialIntegrityOverlay = $referentialIntegrityOverlay; + } + + /** + * Returns if referential integrity overlay is in place. + * + * @return bool overlay in place + */ + public function isReferentialIntegrityOverlayActive() { + return $this->referentialIntegrityOverlay === 'true'; + } + /** * Returns an array of string with all admin names * diff --git a/lam/tests/lib/LAMConfigTest.php b/lam/tests/lib/LAMConfigTest.php index 9689b3ec..d792214d 100644 --- a/lam/tests/lib/LAMConfigTest.php +++ b/lam/tests/lib/LAMConfigTest.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2016 Roland Gruber + Copyright (C) 2016 - 2017 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -154,6 +154,19 @@ class LAMConfigTest extends PHPUnit_Framework_TestCase { $this->assertEquals($val, $this->lAMConfig->getPagedResults()); } + /** + * Tests LAMConfig->getReferentialIntegrityOverlay() and LAMConfig->setReferentialIntegrityOverlay() + */ + public function testReferentialIntegrityOverlay() { + $val = 'true'; + $this->lAMConfig->setReferentialIntegrityOverlay($val); + $this->assertEquals($val, $this->lAMConfig->getReferentialIntegrityOverlay()); + $this->assertTrue($this->lAMConfig->isReferentialIntegrityOverlayActive()); + $this->doSave(); + $this->assertEquals($val, $this->lAMConfig->getReferentialIntegrityOverlay()); + $this->assertTrue($this->lAMConfig->isReferentialIntegrityOverlayActive()); + } + /** * Tests LAMConfig->get_Admins() */