diff --git a/htdocs/admin.php b/htdocs/admin.php index 59dc565..5e5b16e 100644 --- a/htdocs/admin.php +++ b/htdocs/admin.php @@ -38,11 +38,28 @@ if (!empty($_POST['delete'])) { print ''; } +if (!empty($_POST['isactive'])) { + $active = ($_POST['isactive'] == "TRUE") ? true : false; + try { + $domain->update($active); + header('Location: admin.php?domain='.$domain->getName()); + } catch (Exception $e) { + print ''; + } +} ?>
-     + getName().'">'; + if (!$domain->isactive()) { + print '   '; + } else { + print '   '; + } + ?> +     - + +

diff --git a/htdocs/lib/class.ldapdomain.php b/htdocs/lib/class.ldapdomain.php index a31570b..ae9bafa 100644 --- a/htdocs/lib/class.ldapdomain.php +++ b/htdocs/lib/class.ldapdomain.php @@ -128,6 +128,14 @@ class LdapDomain extends LdapServer { } } + public function update($active=false) { + $info["isActive"] = ($active) ? 'TRUE' : 'FALSE'; + if (!ldap_mod_replace($this->conn, "cn=".$this->getName().",".LDAP_BASE, $info)) { + $error = ldap_error($this->conn); + throw new Exception("Erreur pendant la modification du domaine : $error"); + } + } + public function getName() { return $this->domain; }