purge users

This commit is contained in:
2019-10-23 12:06:05 -05:00
parent 02b57d226a
commit a9105b05eb

View File

@@ -90,18 +90,21 @@ class PurgeUsers extends Command
//Get the user's role
$role = UserRole::where(['character_id' => $user->character_id])->first();
//We don't want to modify Admin and SuperUsers. Admins and SuperUsers are removed via a different process.
if($role != 'Admin' || $role != 'SuperUser') {
//Check if the user is allowed to login
if(isset($corp_info->alliance_id)) {
//Warped Intentions is allowed to login
if($corp_info->alliance_id == '99004116') {
//If the role is not Warped Intentions, then modify the role
if($role != 'User') {
//Upate the role of the user
UserRole::where([
'character_id' => $user->character_id,
])->update([
'role' => 'User',
]);
//Update the user type
User::where([
'character_id' => $user->character_id,
])->update([
@@ -110,12 +113,13 @@ class PurgeUsers extends Command
}
} else if(in_array($corp_info->alliance_id, $legacy)) { //Legacy Users
if($role != 'User') {
//Update the role of the user
UserRole::where([
'character_id' => $user->character_id,
])->update([
'role' => 'User',
]);
//Update the user type
User::where([
'character_id' => $user->character_id,
])->update([
@@ -124,12 +128,13 @@ class PurgeUsers extends Command
}
} else if(in_array($corp_info->alliance_id, $renter)) { //Renter Users
if($role != 'Renter') {
//Update the role of the user
UserRole::where([
'character_id' => $user->character_id,
])->update([
'role' => 'Renter',
]);
//Update the user type
User::where([
'character_id' => $user->character_id,
])->update([
@@ -142,16 +147,14 @@ class PurgeUsers extends Command
UserPermission::where([
'character_id' => $user->character_id,
])->delete();
//Delete the user's role
UserRole::where([
'character_id' => $user->character_id,
])->delete();
//Delete any alts the user might have registered.
UserAlt::where([
'main_id' => $user->character_id,
])->delete();
//Delete the user from the user table
User::where([
'character_id' => $user->character_id,
@@ -159,6 +162,9 @@ class PurgeUsers extends Command
}
}
}
}
}
}
}