add admin action to delete accounts
This commit is contained in:
parent
78096d436c
commit
f2418991cd
@ -128,11 +128,19 @@ final class UserController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function deleteAction(Array $A_urlParams = null, Array $A_postParams = null)
|
public function deleteAction(Array $A_urlParams = null, Array $A_postParams = null)
|
||||||
|
{
|
||||||
|
if (count($A_urlParams) ==0 ) {
|
||||||
|
self::userDeleteAction($A_urlParams, $A_postParams);
|
||||||
|
}else{
|
||||||
|
self::adminDeleteAction($A_urlParams, $A_postParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function userDeleteAction(Array $A_urlParams = null, Array $A_postParams = null)
|
||||||
{
|
{
|
||||||
Session::login_or_die();
|
Session::login_or_die();
|
||||||
|
|
||||||
$O_userModel = new UserModel();
|
$O_userModel = new UserModel();
|
||||||
|
|
||||||
$O_userModel->deleteByID($_SESSION["ID"]);
|
$O_userModel->deleteByID($_SESSION["ID"]);
|
||||||
|
|
||||||
Session::destroy_session();
|
Session::destroy_session();
|
||||||
@ -140,4 +148,18 @@ final class UserController
|
|||||||
header("Location: /");
|
header("Location: /");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function adminDeleteAction(Array $A_urlParams = null, Array $A_postParams = null)
|
||||||
|
{
|
||||||
|
Session::admin_or_die();
|
||||||
|
|
||||||
|
$I_user_id = Utils::intOrDie($A_urlParams[0]);
|
||||||
|
|
||||||
|
|
||||||
|
$O_userModel = new UserModel();
|
||||||
|
$O_userModel->deleteByID($I_user_id);
|
||||||
|
|
||||||
|
echo "Le compte à été supprimé avec succès";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user