1
0
Fork 0
mirror of synced 2024-07-01 04:30:59 +12:00

fix, check only for confirmed membership

This commit is contained in:
Damodar Lohani 2024-01-28 02:47:23 +00:00
parent 215a139e87
commit e5dfed0aa3

View file

@ -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);
}
}
}