search endpoint

This commit is contained in:
2019-06-28 21:01:03 -05:00
parent 7de3eb1153
commit 9302b1c8a5

View File

@@ -40,27 +40,22 @@ class WikiController extends Controller
foreach($users as $user) { foreach($users as $user) {
//Let's look up the character in the user table by their name. //Let's look up the character in the user table by their name.
//If no name is found, then delete the user and have them start over with the wiki permissions //If no name is found, then delete the user and have them start over with the wiki permissions
$count = User::where(['name' => $user])->count();
if($count > 0) {
$charIdTemp = User::where(['name' => $user])->get(['character_id']); $charIdTemp = User::where(['name' => $user])->get(['character_id']);
$charId = $charIdTemp[0]->character_id; $charId = $charIdTemp[0]->character_id;
$corpId = $helper->LookupCharacter($charId); $corpId = $helper->LookupCharacter($charId);
$allianceId = $helper->LookupCorporation($corpId); $allianceId = $helper->LookupCorporation($corpId);
if(in_array($allianceId, $legacy) || in_array($allianceId, $renter) || $allianceId == 99004116) { if(in_array($allianceId, $legacy) || in_array($allianceId, $renter) || $allianceId == 99004116) {
//Do nothing //Do nothing
} else { } else {
//Get the uid of the user as we will need to purge them from the member table as well. $this->DeleteWikiUser($user);
//the member table holds their permissions.
$uid = DokuUser::where([
'name' => $user,
])->value('id');
//Delete the permissions of the user first.
DokuMember::where([
'uid' => $uid,
])->delete();
//Delete the user from the user table
DokuUser::where(['name' => $user])->delete();
} }
} else {
$this->DeleteWikiUser($user);
}
} }
return view('admin.dashboard')->with('success', 'Wiki has been purged.'); return view('admin.dashboard')->with('success', 'Wiki has been purged.');
@@ -183,4 +178,19 @@ class WikiController extends Controller
return redirect('/dashboard')->with('success', 'User added to the group: ' . $gid . ' with name of ' . $gname); return redirect('/dashboard')->with('success', 'User added to the group: ' . $gid . ' with name of ' . $gname);
} }
private function DeleteWikiUser($user) {
//Get the uid of the user as we will need to purge them from the member table as well.
//the member table holds their permissions.
$uid = DokuUser::where([
'name' => $user,
])->value('id');
//Delete the permissions of the user first.
DokuMember::where([
'uid' => $uid,
])->delete();
//Delete the user from the user table
DokuUser::where(['name' => $user])->delete();
}
} }