-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Delete Functions * Added correct perm to delete user * Added Group Delete + Life Settings Move To Config * Update Composer * Added Data Table Log For Group/Users * Added Self Password Change * Fixed Perms
- Loading branch information
1 parent
6f2dab9
commit 6ecb93a
Showing
23 changed files
with
641 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace CyberWorks\Core\Controllers\Admin; | ||
|
||
use CyberWorks\Core\Models\Log; | ||
use LiveControl\EloquentDataTable\DataTable; | ||
use CyberWorks\Core\Controllers\Controller; | ||
|
||
class LogController extends Controller | ||
{ | ||
public function userIndex($request, $response) | ||
{ | ||
return $this->view->render($response, 'logs/adminLogTable.twig', ['title' => 'core.perms.users.log', 'api' => 'user']); | ||
} | ||
|
||
public function userTable($request, $response) | ||
{ | ||
$logs = new Log(); | ||
$table = new DataTable($logs->where('type', '5')->orderBy('created_at', 'desc'), ['id', 'message', 'user_id', 'created_at']); | ||
|
||
$table->setFormatRowFunction(function ($log) { | ||
return [ | ||
$log->name, | ||
$log->message, | ||
(string) $log->created_at | ||
]; | ||
}); | ||
|
||
return $response->withJson($table->make()); | ||
} | ||
|
||
public function groupIndex($request, $response) | ||
{ | ||
return $this->view->render($response, 'logs/adminLogTable.twig', ['title' => 'core.perms.group.log', 'api' => 'group']); | ||
} | ||
|
||
public function groupTable($request, $response) | ||
{ | ||
$logs = new Log(); | ||
$table = new DataTable($logs->where('type', '6')->orderBy('created_at', 'desc'), ['id', 'message', 'user_id', 'created_at']); | ||
|
||
$table->setFormatRowFunction(function ($log) { | ||
return [ | ||
$log->name, | ||
$log->message, | ||
(string) $log->created_at | ||
]; | ||
}); | ||
|
||
return $response->withJson($table->make()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace CyberWorks\Core\Helper; | ||
|
||
use CyberWorks\Core\Models\Log; | ||
|
||
class EditLogger | ||
{ | ||
public function logEdit($type, $message) { | ||
$entry = new Log(); | ||
$entry->user_id = $_SESSION['user_id']; | ||
$entry->message = $message; | ||
$entry->type = $type; | ||
|
||
$entry->save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace CyberWorks\Core\Middleware\API; | ||
|
||
use CyberWorks\Core\Models\Group; | ||
use CyberWorks\Core\Middleware\Middleware; | ||
|
||
class GroupIsValidAPIMiddleware extends Middleware | ||
{ | ||
public function __invoke($request, $response, $next) | ||
{ | ||
$group = Group::find($request->getParam('id')); | ||
|
||
if (!$group) { | ||
return $response->withJson(['error' => 'Group Not Found!'], 404); | ||
} | ||
|
||
$response = $next($request, $response); | ||
return $response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.