Only superadmin can enable/disable a domain

This commit is contained in:
Victor LABORIE 2017-12-16 18:00:54 +01:00
parent 8565a9b8a0
commit 392f46ef73

View file

@ -38,7 +38,7 @@ if (!empty($_POST['delete'])) {
print '</div>'; print '</div>';
} }
if (!empty($_POST['isactive'])) { if (!empty($_POST['isactive']) && $server->isSuperAdmin()) {
$active = ($_POST['isactive'] == "TRUE") ? true : false; $active = ($_POST['isactive'] == "TRUE") ? true : false;
try { try {
$domain->update($active); $domain->update($active);
@ -53,10 +53,12 @@ if (!empty($_POST['isactive'])) {
<div class="text-center"> <div class="text-center">
<?php <?php
print '<form name="update" method="post" action="admin.php?domain='.$domain->getName().'">'; print '<form name="update" method="post" action="admin.php?domain='.$domain->getName().'">';
if (!$domain->isactive()) { if ($server->isSuperAdmin()) {
print '<button type="submit" name="isactive" value="TRUE" class="btn btn-primary">Activer le domaine</button>&nbsp;&nbsp;&nbsp;'; if (!$domain->isactive()) {
} else { print '<button type="submit" name="isactive" value="TRUE" class="btn btn-primary">Activer le domaine</button>&nbsp;&nbsp;&nbsp;';
print '<button type="submit" name="isactive" value="FALSE" class="btn btn-primary">Désactiver le domaine</button>&nbsp;&nbsp;&nbsp;'; } else {
print '<button type="submit" name="isactive" value="FALSE" class="btn btn-primary">Désactiver le domaine</button>&nbsp;&nbsp;&nbsp;';
}
} }
?> ?>
<a href="compte.php?domain=<?php print $domain->getName() ?>"><button type="button" class="btn btn-primary">Ajouter un nouveau compte</button></a>&nbsp;&nbsp;&nbsp; <a href="compte.php?domain=<?php print $domain->getName() ?>"><button type="button" class="btn btn-primary">Ajouter un nouveau compte</button></a>&nbsp;&nbsp;&nbsp;