Skip to content

Commit db92f5a

Browse files
committed
prevent user deleting it self
1 parent a01c911 commit db92f5a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Darryldecode/Backend/Components/User/Commands/DeleteUserCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public function handle(User $user, Group $group, Dispatcher $dispatcher)
5252
{
5353
return new CommandResult(false, CommandResult::$responseForbiddenMessage, null, 403);
5454
}
55+
if( $this->user->id == $this->id )
56+
{
57+
return new CommandResult(false, "Cannot delete self.", null, 400);
58+
}
5559
}
5660

5761
// find the user

0 commit comments

Comments
 (0)