VENOM-10: WIP
This commit is contained in:
parent
8d246aa381
commit
5c44d50989
33 changed files with 890 additions and 601 deletions
79
src/modules/RoleModule.php
Normal file
79
src/modules/RoleModule.php
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Modules;
|
||||
|
||||
|
||||
use Venom\Core\Config;
|
||||
use Venom\Core\Module;
|
||||
use Venom\Helper\AdminHelper;
|
||||
use Venom\Routing\Route;
|
||||
use Venom\Routing\Router;
|
||||
use Venom\Venom;
|
||||
|
||||
class RoleModule implements Module, Route
|
||||
{
|
||||
|
||||
public function register(Venom $venom): bool
|
||||
{
|
||||
if (Config::getInstance()->isAdmin()) {
|
||||
$this->registerAdminRoutes($venom);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function init(): void
|
||||
{
|
||||
}
|
||||
|
||||
private function registerAdminRoutes(Venom $venom)
|
||||
{
|
||||
$venom->getRouter(Router::ADMIN_ROUTER)->addRoutes([
|
||||
'/roles' => [
|
||||
'cl' => RoleModule::class,
|
||||
'roles' => ['ROLE_ADMIN'],
|
||||
'routes' => [
|
||||
'*' => [
|
||||
"GET" => 'get',
|
||||
],
|
||||
'1' => [
|
||||
"GET" => 'getById',
|
||||
"POST" => 'update',
|
||||
"PUT" => 'insert',
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
AdminHelper::getResponse([
|
||||
'roles' => [
|
||||
['id' => 1, 'name' => 'Admin', 'icon' => 'vt-visibility'],
|
||||
['id' => 2, 'name' => 'Moderator', 'icon' => 'vt-edit'],
|
||||
['id' => 3, 'name' => 'Gast', 'icon' => 'vt-edit'],
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function insert(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getById($id)
|
||||
{
|
||||
AdminHelper::getResponse([
|
||||
'caseName' => 'ROLE_ADMIN',
|
||||
'id' => $id,
|
||||
'name' => 'Admin',
|
||||
'icon' => 'vt-visibility'
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue