admin dashboard updates

This commit is contained in:
2019-03-06 23:20:46 -06:00
parent ea40901761
commit de6891e995
4 changed files with 389 additions and 77 deletions

View File

@@ -2,14 +2,19 @@
namespace App\Http\Controllers;
//Laravel libraries
use Illuminate\Http\Request;
use DB;
use Auth;
//User Libraries
use App\Library\Lookups\LookupHelper;
//Models
use App\Models\Doku\DokuGroupNames;
use App\Models\Doku\DokuMember;
use App\Models\Doku\DokuUser;
use App\Models\Admin\AllowedLogin;
class WikiController extends Controller
{
@@ -17,6 +22,32 @@ class WikiController extends Controller
$this->middleware('auth');
$this->middleware('role:User');
}
public function purgeUsers() {
//Declare helper classes
$helper = new LookupHelper;
//Get all the users from the database
$users = DokuUser::pluck('name')->all();
$legacy = AllowedLogin::where(['login_type' => 'Legacy'])->pluck('entity_id')->toArray();
$renter = AllowedLogin::where(['login_type' => 'Renter'])->pluck('entity_id')->toArray();
//Search the names and verify against the lookup table
//to find the corporation and / or alliance they belong to.
foreach($users as $user) {
$charId = $helper->CharacterNameToId($user);
$corpId = $helper->LookupCharacter($charId);
$allianceId = $helper->LookupCorporation($corpId);
if(in_array($allianceId, $legacy) || in_array($allianceId, $renter) || $allianceId == 99004116) {
//Do nothing
} else {
DokuUser::where(['name' => $user])->delete();
}
}
return view('/admin/dashboard')->with('success', 'Wiki has been purged.');
}
public function displayRegister() {
//make user name syntax like we want it.