1
0
Fork 0

Move identity deletion into OpenSim function

master
Anonymous Contributor 2023-08-27 12:17:33 +02:00
parent c5871a626b
commit d6ca2e6e00
2 changed files with 19 additions and 7 deletions

View File

@ -267,6 +267,23 @@
} }
} }
public function deleteIdentity($uuid, $identId): bool
{
global $RUNTIME;
$statementValidate = $RUNTIME['PDO']->prepare('SELECT 1 FROM UserIdentitys WHERE PrincipalID = ? AND IdentityID = ?');
$statementValidate->execute([$uuid, $identId]);
if($statementValidate->fetch()) {
$statementDelete = $RUNTIME['PDO']->prepare('DELETE FROM UserAccounts WHERE PrincipalID = ?');
$statementDelete->execute([$identId]);
return true;
}
return false;
}
public function gen_uuid() public function gen_uuid()
{ {
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',

View File

@ -89,13 +89,8 @@
)); ));
if ($validator->isValid($_POST)) { if ($validator->isValid($_POST)) {
$statementValidate = $RUNTIME['PDO']->prepare('SELECT 1 FROM UserIdentitys WHERE PrincipalID = ? AND IdentityID = ?'); include_once 'app/OpenSim.php';
$statementValidate->execute([$_SESSION['UUID'], $_POST['uuid']]); (new OpenSim())->deleteIdentity($_SESSION['UUID'], $_POST['uuid']);
if($statementValidate->fetch()) {
$statementDelete = $RUNTIME['PDO']->prepare('DELETE FROM UserAccounts WHERE PrincipalID = ?');
$statementDelete->execute([$_POST['uuid']]);
}
} }
} }