Skip to content

Commit

Permalink
Skip users with API credentials
Browse files Browse the repository at this point in the history
- to prevent deleting the user and creating orphaned API
  credentials.
  • Loading branch information
gregcorbett committed Jul 29, 2022
1 parent e86f594 commit a97fc22
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions resources/RemoveInactiveUsersRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@

$lastLoginDate = $user->getLastLoginDate();

if (!$user->getAPIAuthenticationEntities()->isEmpty()) {
// Prevent creating orphaned API credentials.
echo "Cannot delete a user with attached API credentials.\n";
// Move onto the next users.
continue;
}

if ($lastLoginDate) { // null lastLoginDate check
$interval = $today->diff($lastLoginDate);
} else { // This might only be run once, since new users always have field filled.
Expand Down

0 comments on commit a97fc22

Please sign in to comment.