fix, check only for confirmed membership
This commit is contained in:
parent
215a139e87
commit
e5dfed0aa3
|
@ -3040,12 +3040,15 @@ App::delete('/v1/account')
|
|||
if ($user->isEmpty()) {
|
||||
throw new Exception(Exception::USER_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
if ($project->getId() === 'console') {
|
||||
// get active memberships
|
||||
// get all memberships
|
||||
$memberships = $user->getAttribute('memberships', []);
|
||||
if (count($memberships) > 0) {
|
||||
throw new Exception(Exception::USER_DELETION_WITH_ACTIVE_TEAMS);
|
||||
foreach ($memberships as $membership) {
|
||||
// prevent deletion if at lease one active membership
|
||||
if($membership->getAttribute('confirm', false)) {
|
||||
throw new Exception(Exception::USER_DELETION_WITH_ACTIVE_TEAMS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue