mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-12-25 04:58:59 +00:00
Ready to implement account deletion.
This commit is contained in:
parent
7ca5a29888
commit
82c47e7b11
@ -102,7 +102,7 @@ class AccountComponent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete token from given informations
|
||||
* Delete login token from given information of a single service
|
||||
*
|
||||
* @param int $userID The ID of the user to delete
|
||||
* @param string $serviceID The service ID
|
||||
@ -125,6 +125,30 @@ class AccountComponent {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all the logins tokens of a user - disconnect him from
|
||||
* all the services he is connected to
|
||||
*
|
||||
* @param int $userID Target user ID
|
||||
* @return bool TRUE for a success / FALSE else
|
||||
*/
|
||||
public function deleteAllUserLoginTokens(int $userID) : bool {
|
||||
|
||||
//Prepare database request
|
||||
$condition = "ID_utilisateurs = ?";
|
||||
$values = array(
|
||||
$userID
|
||||
);
|
||||
|
||||
//Try to perform request
|
||||
if(!CS::get()->db->deleteEntry($this->userLoginAPItable, $condition, $values))
|
||||
return false; //Something went wrong during the request
|
||||
|
||||
//Everything is ok
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get User ID from token
|
||||
*
|
||||
@ -287,19 +311,29 @@ class AccountComponent {
|
||||
|
||||
//Remove users from all its conversations
|
||||
if(!components()->conversations->deleteAllUserConversations($userID))
|
||||
return FALSE;*/
|
||||
return FALSE;
|
||||
|
||||
//Delete all the notifications related with the user
|
||||
if(!components()->notifications->deleteAllRelatedWithUser($userID))
|
||||
return FALSE;
|
||||
|
||||
//Delete all user friends, including friendship requests
|
||||
if(!components()->friends->deleteAllUserFriends($userID))
|
||||
return FALSE;
|
||||
|
||||
//Delete user account image
|
||||
if(!components()->accountImage->delete($userID))
|
||||
return FALSE;
|
||||
|
||||
//Delete connections to all the services
|
||||
if(!$this->deleteAllUserLoginTokens($userID))
|
||||
return FALSE;*/
|
||||
|
||||
//Delete user from the database
|
||||
//WILL BE IMPLEMENTED WHEN LEGACY VERSION WILL BE REMOVED
|
||||
|
||||
//Success
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user