added new features to the admin panel
This commit is contained in:
@@ -81,17 +81,30 @@ class AdminController extends Controller
|
|||||||
|
|
||||||
/** Users & Permissions Pane */
|
/** Users & Permissions Pane */
|
||||||
$userArr = array();
|
$userArr = array();
|
||||||
$userArrs = array();
|
/**
|
||||||
|
* For each user we want to build their name and permission set into one array
|
||||||
|
* Having all of the data in one array will allow us to build the table for the admin page more fluently.
|
||||||
|
* Example: userArrs[0]['name'] = Minerva Arbosa
|
||||||
|
* userArrs[0]['permissions'] = ['admin', 'contract.admin', superuser]
|
||||||
|
*/
|
||||||
|
$users = User::all()->orderBy('name', 'desc')->toArray();
|
||||||
|
foreach($users as $user) {
|
||||||
|
$permissions = UserPermission::where([
|
||||||
|
'character_id' => $user['character_id'],
|
||||||
|
])->get()->toArray();
|
||||||
|
|
||||||
|
$tempUser['name'] = $user['name'];
|
||||||
|
$tempUser['role'] = $user['role'];
|
||||||
|
$tempUser['permissions'] = $permissions;
|
||||||
|
|
||||||
|
array_push($userArry, $tempUser);
|
||||||
|
}
|
||||||
|
|
||||||
//Get the users from the database to allow a selection of users for various parts of the webpage
|
//Get the users from the database to allow a selection of users for various parts of the webpage
|
||||||
$users = User::pluck('name')->all();
|
$users = User::pluck('name')->all();
|
||||||
//Get the available permissions from the database to allow a selection of permissions
|
//Get the available permissions from the database to allow a selection of permissions
|
||||||
$permissions = AvailableUserPermission::pluck('permission')->all();
|
$permissions = AvailableUserPermission::pluck('permission')->all();
|
||||||
|
|
||||||
//For each user we need to build their username and permissions array into one array
|
|
||||||
/**
|
|
||||||
* Example: userArrs[0]['name'] = Minerva Arbosa
|
|
||||||
* userArrs[0]['permissions'] = ['admin', 'contract.admin', superuser]
|
|
||||||
*/
|
|
||||||
foreach($users as $key => $value) {
|
foreach($users as $key => $value) {
|
||||||
$user[$value] = $value;
|
$user[$value] = $value;
|
||||||
}
|
}
|
||||||
@@ -117,6 +130,7 @@ class AdminController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return view('admin.dashboard')->with('data', $data)
|
return view('admin.dashboard')->with('data', $data)
|
||||||
|
->with('userArr', $userArr)
|
||||||
->with('pis', $pis)
|
->with('pis', $pis)
|
||||||
->with('industrys', $industrys)
|
->with('industrys', $industrys)
|
||||||
->with('offices', $offices)
|
->with('offices', $offices)
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ class WikiController extends Controller
|
|||||||
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.
|
||||||
|
//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();
|
DokuUser::where(['name' => $user])->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,8 @@ class DokuGroupNames extends Model
|
|||||||
protected $table = 'wiki_groupnames';
|
protected $table = 'wiki_groupnames';
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'gname',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,10 @@ class DokuMember extends Model
|
|||||||
protected $table = 'wiki_member';
|
protected $table = 'wiki_member';
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'uid',
|
||||||
|
'gid',
|
||||||
|
'groupname',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,11 @@ class DokuUser extends Model
|
|||||||
|
|
||||||
// Timestamps
|
// Timestamps
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'login',
|
||||||
|
'pass',
|
||||||
|
'name',
|
||||||
|
'mail',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li class="nav-item active"><a class="nav-link active" data-toggle="tab" href="#user">User</a></li>
|
<li class="nav-item active"><a class="nav-link active" data-toggle="tab" href="#user">User</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#userTable">User Table</a></li>
|
||||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#permissions">Permissions</a></li>
|
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#permissions">Permissions</a></li>
|
||||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#roles">Roles</a></li>
|
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#roles">Roles</a></li>
|
||||||
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#logins">Login</a></li>
|
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#logins">Login</a></li>
|
||||||
@@ -35,6 +36,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="userTable" class="tab-pane fade">
|
||||||
|
<div class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Role</th>
|
||||||
|
<th>Permissions</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($userArr as $user)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $user['name'] }}</td>
|
||||||
|
<td>{{ $user['role'] }}</td>
|
||||||
|
<td>
|
||||||
|
@foreach($user['permissions'] as $perm)
|
||||||
|
{{ $perm . ", " }}
|
||||||
|
@endforeach
|
||||||
|
</td>
|
||||||
|
<td>Remove, Modify</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="permissions" class="tab-pane fade">
|
<div id="permissions" class="tab-pane fade">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -127,7 +152,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="wiki" class="tab-pane fade">
|
<div id="wiki" class="tab-pane fade">
|
||||||
Placeholder for when a button is available
|
{!! Form::open(['action' => 'Wiki\WikiController@purgeUsers', 'method' => 'POST']) !!}
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('admin', 'This action will log the administrator who peformed the action.') }}
|
||||||
|
{{ Form::hidden('admin', auth()->user()->character_id) }}
|
||||||
|
</div>
|
||||||
|
{{ Form::submit('Purge Wiki', ['class' => 'btn btn-primary']) }}
|
||||||
|
{!! Form::close() !!}
|
||||||
</div>
|
</div>
|
||||||
<div id="taxes" class="tab-pane fade">
|
<div id="taxes" class="tab-pane fade">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ Route::group(['middleware' => ['auth']], function(){
|
|||||||
Route::post('/wiki/register', 'Wiki\WikiController@storeRegister');
|
Route::post('/wiki/register', 'Wiki\WikiController@storeRegister');
|
||||||
Route::get('/wiki/changepassword', 'Wiki\WikiController@displayChangePassword');
|
Route::get('/wiki/changepassword', 'Wiki\WikiController@displayChangePassword');
|
||||||
Route::post('/wiki/changepassword', 'Wiki\WikiController@changePassword');
|
Route::post('/wiki/changepassword', 'Wiki\WikiController@changePassword');
|
||||||
|
Route::post('/wiki/purge', 'Wiki\WikiController@purgeeUsers');
|
||||||
|
|
||||||
//Admin Controller display pages
|
//Admin Controller display pages
|
||||||
Route::get('/admin/dashboard', 'Dashboard\AdminController@displayDashboard');
|
Route::get('/admin/dashboard', 'Dashboard\AdminController@displayDashboard');
|
||||||
|
|||||||
Reference in New Issue
Block a user