purge users
This commit is contained in:
@@ -90,18 +90,21 @@ class PurgeUsers extends Command
|
|||||||
//Get the user's role
|
//Get the user's role
|
||||||
$role = UserRole::where(['character_id' => $user->character_id])->first();
|
$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
|
//Check if the user is allowed to login
|
||||||
if(isset($corp_info->alliance_id)) {
|
if(isset($corp_info->alliance_id)) {
|
||||||
//Warped Intentions is allowed to login
|
//Warped Intentions is allowed to login
|
||||||
if($corp_info->alliance_id == '99004116') {
|
if($corp_info->alliance_id == '99004116') {
|
||||||
//If the role is not Warped Intentions, then modify the role
|
//If the role is not Warped Intentions, then modify the role
|
||||||
if($role != 'User') {
|
if($role != 'User') {
|
||||||
|
//Upate the role of the user
|
||||||
UserRole::where([
|
UserRole::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
])->update([
|
])->update([
|
||||||
'role' => 'User',
|
'role' => 'User',
|
||||||
]);
|
]);
|
||||||
|
//Update the user type
|
||||||
User::where([
|
User::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
])->update([
|
])->update([
|
||||||
@@ -110,12 +113,13 @@ class PurgeUsers extends Command
|
|||||||
}
|
}
|
||||||
} else if(in_array($corp_info->alliance_id, $legacy)) { //Legacy Users
|
} else if(in_array($corp_info->alliance_id, $legacy)) { //Legacy Users
|
||||||
if($role != 'User') {
|
if($role != 'User') {
|
||||||
|
//Update the role of the user
|
||||||
UserRole::where([
|
UserRole::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
])->update([
|
])->update([
|
||||||
'role' => 'User',
|
'role' => 'User',
|
||||||
]);
|
]);
|
||||||
|
//Update the user type
|
||||||
User::where([
|
User::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
])->update([
|
])->update([
|
||||||
@@ -124,12 +128,13 @@ class PurgeUsers extends Command
|
|||||||
}
|
}
|
||||||
} else if(in_array($corp_info->alliance_id, $renter)) { //Renter Users
|
} else if(in_array($corp_info->alliance_id, $renter)) { //Renter Users
|
||||||
if($role != 'Renter') {
|
if($role != 'Renter') {
|
||||||
|
//Update the role of the user
|
||||||
UserRole::where([
|
UserRole::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
])->update([
|
])->update([
|
||||||
'role' => 'Renter',
|
'role' => 'Renter',
|
||||||
]);
|
]);
|
||||||
|
//Update the user type
|
||||||
User::where([
|
User::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
])->update([
|
])->update([
|
||||||
@@ -142,16 +147,14 @@ class PurgeUsers extends Command
|
|||||||
UserPermission::where([
|
UserPermission::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
])->delete();
|
])->delete();
|
||||||
|
|
||||||
//Delete the user's role
|
//Delete the user's role
|
||||||
UserRole::where([
|
UserRole::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
])->delete();
|
])->delete();
|
||||||
|
//Delete any alts the user might have registered.
|
||||||
UserAlt::where([
|
UserAlt::where([
|
||||||
'main_id' => $user->character_id,
|
'main_id' => $user->character_id,
|
||||||
])->delete();
|
])->delete();
|
||||||
|
|
||||||
//Delete the user from the user table
|
//Delete the user from the user table
|
||||||
User::where([
|
User::where([
|
||||||
'character_id' => $user->character_id,
|
'character_id' => $user->character_id,
|
||||||
@@ -159,6 +162,9 @@ class PurgeUsers extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user