search endpoint
This commit is contained in:
@@ -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
|
||||||
$charIdTemp = User::where(['name' => $user])->get(['character_id']);
|
$count = User::where(['name' => $user])->count();
|
||||||
$charId = $charIdTemp[0]->character_id;
|
if($count > 0) {
|
||||||
|
$charIdTemp = User::where(['name' => $user])->get(['character_id']);
|
||||||
|
$charId = $charIdTemp[0]->character_id;
|
||||||
|
$corpId = $helper->LookupCharacter($charId);
|
||||||
|
$allianceId = $helper->LookupCorporation($corpId);
|
||||||
|
|
||||||
$corpId = $helper->LookupCharacter($charId);
|
if(in_array($allianceId, $legacy) || in_array($allianceId, $renter) || $allianceId == 99004116) {
|
||||||
$allianceId = $helper->LookupCorporation($corpId);
|
//Do nothing
|
||||||
if(in_array($allianceId, $legacy) || in_array($allianceId, $renter) || $allianceId == 99004116) {
|
} else {
|
||||||
//Do nothing
|
$this->DeleteWikiUser($user);
|
||||||
|
}
|
||||||
} 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user