mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
PHRAS-357 Fix delete user oauth apps & accounts
This commit is contained in:
@@ -967,7 +967,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo close all open session
|
||||
* @return type
|
||||
*/
|
||||
public function delete()
|
||||
@@ -1038,6 +1037,24 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
$stmt->execute(array(':usr_id' => $this->get_id()));
|
||||
$stmt->closeCursor();
|
||||
|
||||
// delete created app
|
||||
$oauthApps = API_OAuth2_Application::load_dev_app_by_user($this->app, $this);
|
||||
|
||||
// delete accounts for thos app
|
||||
foreach ($oauthApps as $oauthApp) {
|
||||
$account = API_OAuth2_Account::load_with_user($this->app, $oauthApp, $this);
|
||||
$account->delete();
|
||||
$oauthApp->delete();
|
||||
}
|
||||
|
||||
// delete any other account
|
||||
$oauthApps = API_OAuth2_Application::load_app_by_user($this->app, $this);
|
||||
|
||||
foreach ($oauthApps as $oauthApp) {
|
||||
$account = API_OAuth2_Account::load_with_user($this->app, $oauthApp, $this);
|
||||
$account->delete();
|
||||
}
|
||||
|
||||
unset(self::$_instance[$this->get_id()]);
|
||||
|
||||
return;
|
||||
|
Reference in New Issue
Block a user