function __construct($pdo) { $this->pdo = $pdo; $sm = new SecurityManager(); $sm->denyAll(); $sm->allow(SecurityManager::SECURITY_MANAGER_MASK_ADMIN); $sm->checkSecurity(); }
function remove($id) { $sm = new SecurityManager(); $sm->denyAll(); $sm->allow(SecurityManager::SECURITY_MANAGER_MASK_ADMIN); $sm->checkSecurity(); if ($id == -1) { throw new SecuritySevereException("Could not delete the SuperAdmin"); } $sth = $this->pdo->prepare("UPDATE users SET active = 0 WHERE id = ?"); $res = $sth->execute(array($id)); if ($res == 0) { throw new Exception("Impossible de supprimer cet utilisateur."); } if (isset($_REQUEST["origin"])) { header('Location: ' . $_REQUEST["origin"]); } else { header('Location: ' . '/monitoring/?v=dashboard&cat=users'); } }