/** Datei: plugins/users/library/ARUNOX/Plugins/Users/Model.php **/ $user->id, "role" => $user->role, "hashid" => $user->hashid, "tenant_id" => $user->tenant_id ?? NULL, ]; } public static function removeCurrent() : void { $_SESSION["user"] = []; } public static function isLoggedIn() { return !!static::getCurrent(); } /* ### MAGIC FUNCTIONS ########################################## # */ #[PHP\Attributes\Magic\Call( "is([A-Z][a-zA-Z0-9]+)" )] public static function handleUsersIsCall( array $matches, ...$args ) { if( NULL !== $role = Role::getByConstant( $matches[1] ) ) { return static::getCurrent( "role" ) === $role; } throw new PHP\Attributes\Magic\Call\Exceptions\PatternFailed(); } #[PHP\Attributes\Magic\Call( "get([A-Z][a-zA-Z0-9]+)" )] public static function handleUsersGetCall( array $matches, ...$args ) { $name = preg_split('/(?=[A-Z])/', $matches[1] ); $name = array_filter( $name ); $name = implode( "_", $name ); $name = strtolower( $name ); $user = static::getCurrent(); if( !$user || !key_exists( $name, $user ) ) { throw new PHP\Attributes\Magic\Call\Exceptions\PatternFailed(); } return $user[ $name ] ?? NULL; } } /** Datei: plugins/users/library/ARUNOX/Plugins/Users/API/v1/Routes.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Users\API\v1; use ARUNOX\Core\Hooks; use ARUNOX\Core\Router; use ARUNOX\Plugins\REST; class Routes { public static function register() : void { /* ### MAIN ROUTES ############################## # */ Router::addAll( Controller::class ); /* ### MENU ROUTES ############################## # */ Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "path" => "/users", "label" => "Benutzer", "icon" => "bi bi-person", "menu" => "management", ]; $routes[] = [ "path" => "/users/{id}", "label" => "Bearbeiten", ]; $routes[] = [ "path" => "/logout", "icon" => "bi bi-power", "title" => "Abmelden", "color" => [ "color" => REST\Generator\Config\Color::Danger, "target" => "button" ], "menu" => [ "navbar", "logout" ], ]; $routes[] = [ "path" => "/users/me", "icon" => "bi bi-person", "title" => "Mein Profil", "menu" => "navbar", ]; return $routes; }); } } /** Datei: plugins/users/library/ARUNOX/Plugins/Users/API/v1/Controller.php **/ * @copyright 2025 ARUNOX * @version 1.1.0 * * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\Users\API\v1; use ARUNOX\HTTP; use ARUNOX\API\PHP; use ARUNOX\Core\Hooks; use ARUNOX\Plugins\Logs; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Users; use ARUNOX\API\BaseController; use ARUNOX\Database\BaseEntity; #[PHP\Attributes\Controller\Label( "Benutzer" )] #[PHP\Attributes\Controller\Icon( REST\Generator\Config\Icon::Person )] #[PHP\Attributes\Controller\Route( "users" )] #[PHP\Attributes\Database\Definitions\Model( Users\Model::class )] class Controller extends BaseController { /* ### VARIABLES ################################################ # */ protected static array $NOTIFY = [ "notfound" => "Benutzer nicht gefunden", "saved" => "Benutzer wurde erfolgreich gespeichert", "deleted" => "Benutzer wurde erfolgreich gelöscht", "created" => "Benutzer wurde erfolgreich erstellt", "statuschanged.0" => "Benutzer wurde erfolgreich deaktiviert", "statuschanged.1" => "Benutzer wurde erfolgreich aktiviert", "notcreated" => "Benutzer konnte nicht erstellt werden", "notsaved" => "Benutzer konnte nicht gespeichert werden", "passwordchanged" => "Passwort wurde erfolgreich geändert", "loginfailed" => "Anmeldung nicht erfolgreich", "loggedin" => "Erfolgreich angemeldet", "loggedout" => "Erfolgreich abgemeldet", "simulationstarted" => "Simulation gestartet", "simulationstopped" => "Simulation beendet", ]; /* ### PUBLIC GET FUNCTIONS ##################################### # */ /** * @api * @method GET * * @route.path /users * @route.description Listet alle Benutzer */ public static function getAll() : array { return Users\Model::getAll(); } /** * @api * @method GET * * @route.path /users/{hashid} * @route.description Gibt einen einzelnen Benutzer anhand der ID zurück */ public static function get( int|string $hashid ) : BaseEntity | HTTP\Response { if( $result = Users\Model::get( $hashid ) ) return $result; return REST\Response::autoResponse( 404, static::$NOTIFY["notfound"] ); } /** * @api * @method POST * * @route.path /login * @route.description Check Benutzer Login */ public static function login( array $data ) : HTTP\Response { if( $result = Users\Model::getByEmail( $data["email"] ) ) { if( $result->checkPasswort( $data["password"] ) ) { Users\Model::setCurrent( $result ); return REST\Response::autoResponse( 200, static::$NOTIFY["loggedin"] ); } } return REST\Response::autoResponse( 500, static::$NOTIFY["loginfailed"] ); } /** * @api * @method GET * * @route.path /logout * @route.description Benutzer Logout */ public static function logout() : HTTP\Response { Users\Model::removeCurrent(); return REST\Response::autoResponse( 200, static::$NOTIFY["loggedout"] ); } /* ### PUBLIC SAVE FUNCTIONS #################################### # */ /** * @api * @method PUT * * @route.path /users/{hashid} * @route.description Speichert Änderungen an einem bestehenden Benutzer */ public static function save( int|string $hashid, array $data ) : HTTP\Response { if( $result = Users\Model::get( $hashid ) ) { if( $result->save( $data ) ) { return REST\Response::autoResponse( 200, static::$NOTIFY["saved"] ); } return REST\Response::autoResponse( 500, static::$NOTIFY["notsaved"] ); } return REST\Response::autoResponse( 404, static::$NOTIFY["notfound"] ); } /** * @api * @method POST * * @route.path /users * @route.description Erstellt einen neuen Agent */ public static function create( array $data ) : HTTP\Response { if( $hashid = Users\Model::save( $data ) ) { $result = Users\Model::get( $hashid ); return REST\Response::autoResponse( 200, static::$NOTIFY["created"], [ "data" => $result ] ); } return REST\Response::autoResponse( 500, static::$NOTIFY["notfound"] ); } /** * @api * @method DELETE * * @route.path /users/{hashid} * @route.description Löscht einen Agent anhand der ID */ public static function delete( int|string $hashid ) : HTTP\Response { if( Users\Model::delete( $hashid ) ) { return REST\Response::autoResponse( 200, static::$NOTIFY["deleted"] ); } return REST\Response::autoResponse( 500, static::$NOTIFY["notfound"] ); } /** * @api * @method PATCH * * @route.path /users/{hashid}/status * @route.description Wechselt den Status (aktiv/inaktiv) eines Benutzers */ public static function toggleStatus( int|string $hashid ) : HTTP\Response { if( $result = Users\Model::get( $hashid ) ) { $result->toggleStatus( TRUE ); return REST\Response::autoResponse( 200, static::$NOTIFY["statuschanged.{$result->status->getValue()}"], [ "data" => $result ] ); } return REST\Response::autoResponse( 404, static::$NOTIFY["notfound"] ); } /** * @api * @method PATCH * * @route.path /users/{hashid}/password * @route.description Ändern des Passworts eines Benutzers */ public static function changePassword( int|string $hashid, array $data ) { if( $result = Users\Model::get( $hashid ) ) { $result->changePassword( $data["password"], TRUE ); return REST\Response::autoResponse( 200, static::$NOTIFY["passwordchanged"], [ "data" => $result ] ); } return REST\Response::autoResponse( 404, static::$NOTIFY["notfound"] ); } public function startSimulate( int $id ) { if( $result = Users\Model::get( $id ) ) { $result->toggleStatus( TRUE ); REST\Response::addUpdater( [ "data/table/row", $id ], $result ); } else REST\Response::addNotify( "danger", static::$NOTIFY["notfound"] ); return REST\Response::jsonResponse(); } /* ### PUBLIC VALIDATE FUNCTIONS ################################ # */ /** * @api * @method POST * * @route.path /users/{hashid}/validate/username * @route.description Validiert eingegeben Benutzernamen */ public static function validateUsername( int|string $hashid, array $data ) { if( isset( $data["value"] ) && $data["value"] ) { if( $result = Users\Model::getByUsername( $data["value"] ) ) { if( $result->id != $hashid && $result->hashid != $hashid ) { return REST\Response::jsonResponse( 200, [ "valid" => FALSE ] ); } } } return REST\Response::jsonResponse( 200, [ "valid" => TRUE ] ); } /** * @api * @method POST * * @route.path /users/{hashid}/validate/email * @route.description Validiert eingegebene E-Mail-Adresse */ public static function validateEmail( int|string $hashid, array $data ) { if( isset( $data["value"] ) && $data["value"] ) { if( $result = Users\Model::getByEmail( $data["value"] ) ) { if( $result->id != $hashid && $result->hashid != $hashid ) { return REST\Response::jsonResponse( 200, [ "valid" => FALSE ] ); } } } return REST\Response::jsonResponse( 200, [ "valid" => TRUE ] ); } /* ### PUBLIC REST FUNCTIONS #################################### # */ /* ### PUBLIC REST RESPONSE FUNCTIONS ########################### # */ /** * @internal rest * @method PUT * * @route.path /users/{hashid} * @route.description REST-Antwort nach dem Speichern eines Benutzers */ public static function restResponseSave( int|string $hashid, array $data ) : HTTP\Response { $result = static::save( $hashid, $data ); if( $result->isStatus( 200 ) ) { $data = Users\Model::get( $hashid ); REST\Response::addUpdater( [ "data/table/row", $hashid ], $data ); } return static::restResponse( $result ); } /** * @internal rest * @method POST * * @route.path /users * @route.description REST-Antwort nach dem Erstellen eines Benutzers (inkl. Notifikation, Redirect etc.) */ public static function restResponseCreate( array $data ) : HTTP\Response { $result = static::create( $data ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/users/{$result->getBody("data", "hashid")}" ); } return static::restResponse( $result ); } /** * @internal rest * @method DELETE * * @route.path /users/{hashid} * @route.description REST-Antwort nach dem Löschen eines Benutzers */ public static function restResponseDelete( int|string $hashid ) : HTTP\Response { REST\Response::closeModals(); $result = static::delete( $hashid ); if( $result->isStatus( 200 ) ) { REST\Response::redirect( "/users" ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /users/{hashid}/status * @route.description REST-Antwort zur Status-Umschaltung eines Benutzers (z. B. für Notifications) */ public static function restResponseToggleStatus( int|string $hashid ) : HTTP\Response { $result = static::toggleStatus( $hashid ); if( $result->isStatus( 200 ) ) { $data = $result->getBody("data"); REST\Response::addUpdater( [ "data/table/row", $hashid ], $data ); } return static::restResponse( $result ); } /** * @internal rest * @method PATCH * * @route.path /users/{hashid}/password * @route.description REST-Antwort zur Status-Umschaltung eines Benutzers (z. B. für Notifications) */ public static function restResponseChangePassword( int|string $hashid, array $data ) : HTTP\Response { $result = static::changePassword( $hashid, $data ); if( $result->isStatus( 200 ) ) { $data = $result->getBody("data"); REST\Response::addUpdater( [ "data/table/row", $hashid ], $data ); } return static::restResponse( $result ); } /** * @internal rest * @method POST * * @route.path /login * @route.description REST-Konfiguration für Benutzer Lougoin */ public static function restResponseLogin( array $data ) : HTTP\Response { return static::restResponse( static::login( $data ), function(){ $referer = HTTP\Request::referer(); // if( isset( $referer["query"]["redirect"] ) ) { // REST\Response::redirect( $referer["query"]["redirect"] ); // } redirect( "/api/v1/rest/{$referer["path"]}" ); }); } /** * @internal rest * @method GET * * @route.path /logout * @route.description REST-Konfiguration für Benutzer Logout */ public static function restResponseLogout() { return static::restResponse( static::logout(), function(){ static::restConfigLogin(); }, TRUE ); } /* ### PUBLIC REST CONFIG FUNCTIONS ############################# # */ /** * @internal rest * @method GET * * @route.path /users * @route.description REST-Konfiguration für Benutzer-Tabelle */ public static function restConfigOverview() : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "overview", "Benutzer" ) ->get() ->setApi( "/users" ) ->setAction( "/users/{hashid}" ) ->setOrder( "name", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "username", TRUE, TRUE, TRUE, "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->icon", [ "icon" => "bi-key", "options" => Users\Role::getAll(), ], "role", [], "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], "users", "hashid" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->email", [], "email", TRUE, TRUE, TRUE, "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", FALSE, FALSE, TRUE, "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "users" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->password", [], "users", "hashid" )) ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "users", "hashid" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "users", "hashid" )); } /** * @internal rest * @method GET * * @route.path /users/{hashid} * @route.alternative.0 /users/{hashid}#kontext * @route.alternative.1 /users/{hashid}#chat * @route.alternative.2 /users/{hashid}#telefon * @route.description REST-Konfiguration für Detailansicht eines benutzers */ public static function restConfigDetails( int|string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addWrapper( "details", "Assistent bearbeiten" ) ->setBacklink( "/users" ) ->get() ->setApi( "/users/{$hashid}" ) ->setAction( "/users/{$hashid}", "PUT" ) ->addTab( "User" )->get() ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "username", TRUE, "users" )) ->addField(...Hooks::filter( "rest.generator::control.type->email", [], "email", TRUE, "users" )) ->addField(...Hooks::filter( "rest.generator::control.type->select", [ "options" => Users\Role::getAll(), ], "role", TRUE, FALSE, "users" )) ->parent() ->addCallable( [ Logs\API\v1\Controller::class, "restConfigTab" ], $hashid ) ->addTab( "Password" )->get() ->setColor( REST\Generator\Config\Color::Secondary ) ->setIcon( "bi bi-key" ) ->setType( "button" ) ->setAction( "/users/{$hashid}/password", "GET" ) ->parent() ->addTab( "Speichern" )->get() ->setColor( REST\Generator\Config\Color::Primary ) ->setIcon( "bi bi-save" ) ->setType( "submit" ) ; } /** * @internal rest * @method GET * * @route.path /users/create * @route.description REST-Konfiguration für das Erstellen eines Benutzers (Formular) */ public static function restConfigCreate() : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Benutzer erstellen" ) ->setData([ "hashid" => "-NEW-" ]) ->get() ->setAction( "/users", "POST" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Erstellen", "users", "hashid" )) ->addField(...Hooks::filter( "rest.generator::control.type->select", [ "options" => Users\Role::getAll(), ], "role", TRUE, FALSE, "users" )) ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "username", TRUE, "users", "hashid" )) ->addField(...Hooks::filter( "rest.generator::control.type->email", [], "email", TRUE, "users", "hashid" )) ; } /** * @internal rest * @method GET * * @route.path /users/{hashid}/delete * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Benutzers */ public static function restConfigDelete( int|string $hashid ) : REST\Generator\Base\BaseGenerator { return REST\Response::addModal( "details", "Benutzer Löschen" ) ->setSize( REST\Wrapper\Modal\Size::sm ) ->get() ->setAction( "/users/{$hashid}", "DELETE" ) ->addText( "Möchtest du wirklich den Datensatz (#{$hashid}) löschen? " ) ->addButton(...Hooks::filter( "rest.generator::button.type->cancel", [], NULL, "users" )) ->addButton(...Hooks::filter( "rest.generator::button.type->delete", [], NULL, "users" )); } /** * @internal rest * @method GET * * @route.path /users/{hashid}/password * @route.description REST-Konfiguration für die Lösch-Bestätigung eines Benutzers */ public static function restConfigPassword( int|string $hashid ) : REST\Generator\Base\BaseGenerator { if( $result = Users\Model::get( $hashid ) ) { return REST\Response::addModal( "details", "Passwort ändern" ) ->get() ->setAction( "/api/v1/users/{$hashid}/password", "PATCH" ) ->addText( "Benutzer: {$result->username} (#{$result->hashid})" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Speichern", "users" )) ->addField(...Hooks::filter( "rest.generator::control.type->password", [], "password", TRUE, "login" )); } else return REST\Response::addNotify( "danger", static::$NOTIFY["notfound"] ); } /** * @internal rest * @method GET * * @route.path /login * @route.description REST-Konfiguration für Benutzer Login */ public static function restConfigLogin() { REST\Response::setTemplate( "login" ); return REST\Response::addWrapper( "details", "Willkommen zurück" ) ->setHistory() ->get() ->addText( "Logge dich ein um fortzufahren" ) ->setAction( "/api/v1/login", "POST" ) ->addButton(...Hooks::filter( "rest.generator::button.type->submit", [], "Anmelden", "users" )) // ->addField(...Hooks::filter( "rest.generator::control.type->text", [], "text", TRUE, "login" )) ->addField(...Hooks::filter( "rest.generator::control.type->email", [], "email", TRUE, "login" )) ->addField(...Hooks::filter( "rest.generator::control.type->password", [], "password", FALSE, "login" )) ->top(); } /* ### PUBLIC REST PREPARE FUNCTIONS ############################ # */ public static function restConfigTable() { return REST\Generator\Data\Table::create() ->setApi( "/api/v1/users" ) ->setAction( "/api/v1/users/{hashid}" ) ->setOrder( "username", "asc" ) ->setSearch( TRUE ) ->addButton(...Hooks::filter( "rest.generator::button.name->create", [], "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->text", [], "username", TRUE, TRUE, TRUE, "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->icon", [], "role", [], "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->status", [], "status", [], "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->email", [], "email", TRUE, TRUE, TRUE, "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->datetime", [], "date_edit", FALSE, FALSE, TRUE, "users" )) ->addColumn(...Hooks::filter( "rest.generator::column.type->actions", [], [], FALSE, "users" ))->get() ->addButton(...Hooks::filter( "rest.generator::action.name->edit", [], "users" )) ->addButton(...Hooks::filter( "rest.generator::action.name->delete", [], "users" )) ->top(); } } /** Datei: plugins/users/library/ARUNOX/Plugins/Users/Role.php **/ [ "color" => REST\Generator\Config\Color::Danger, "label" => "Superadmin", "icon" => "bi bi-person-fill-lock" ], 1 => [ "color" => REST\Generator\Config\Color::Warning, "label" => "Admin", "icon" => "bi bi-person-fill-gear" ], 2 => [ "color" => REST\Generator\Config\Color::Success, "label" => "User", "icon" => "bi bi-person-fill" ], ]; /* ### PUBLIC FUNCTIONS ######################################### # */ /* ### MAGIC FUNCTIONS ########################################## # */ } /** Datei: plugins/users/library/ARUNOX/Plugins/Users/Entity.php **/ status->is( Attribute\Status::Inactive ) ) return FALSE; return password_verify( $password, $this->password ); } public function changePassword( string $password, bool $save = FALSE ) { $this->password = password_hash( $password, PASSWORD_BCRYPT ); if( $save ) $this->save(); } public function toggleStatus( bool $save = FALSE ) { $this->status->toggle(); if( $save ) $this->save(); } } /** Datei: plugins/users/hooks/generator/controls.php **/ username.users", function( array $config ) { return array_replace_recursive( $config, [ "label" => "Benutzername", "validate" => [ "required" => "Bitte geben Sie einen Benutzernamen an!", "request" => [ "route" => "/users/{hashid}/validate/username", "method" => "POST", "waiting" => "Eingabe wird überprüft!", "message" => "Der eingegeben Benutzername wird bereits verwendet!", ], ], ]); }); Hooks::add("rest.generator::control.name->email.users", function( array $config ) { return array_replace_recursive( $config, [ "validate" => [ "request" => [ "route" => "/users/{hashid}/validate/email", "method" => "POST", "waiting" => "Eingabe wird überprüft!", "message" => "Der eingegeben E-Mail-Adresse wird bereits verwendet!", ], ], ]); }); Hooks::add("rest.generator::control.type->select", function( array $config ) { foreach( $config["options"] as &$option ) { if( $option["value"] < Users\Model::getRole() ) { $option = NULL; } } $config["options"] = array_filter( $config["options"] ); $config["options"] = array_values( $config["options"] ); return $config; }); /** Datei: plugins/users/hooks/generator/buttons.php **/ password", function( array $config, string $plugin, string $route_id = "id" ) { return array_replace_recursive([ "label" => "Passwort ändern", "color" => REST\Generator\Config\Color::Secondary, "icon" => "bi bi-key", "action" => "/{$plugin}/{{$route_id}}/password", ], $config ); }); Hooks::add("rest.generator::button.name->simulate", function( array $config, string $plugin, string $route_id = "id" ) { return array_replace_recursive([ "label" => "Benutzer simulieren", "color" => REST\Generator\Config\Color::Default, "icon" => "bi bi-play-fill", "action" => "/{$plugin}/{{$route_id}}/simulate", ], $config ); }); /** Datei: plugins/users/hooks/generator/columns.php **/ username.users", function( array $config ) { return array_replace_recursive( $config, [ "label" => "Benutzername", ]); }); /** Datei: plugins/users/hooks/init.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ use ARUNOX\Core\Hooks; use ARUNOX\Plugins\REST; use ARUNOX\Plugins\Users; Hooks::add( 'router::resolve->before', function( $route ) { [ $uri, $method ] = $route; if( $uri === "/rest/login" ) return $route; return $route; if( !Users\Model::isLoggedIn() ) { $route = [ "/rest/login", "GET", ]; // REST\Response::redirect( "/login?redirect={$uri}" ); // REST\Response::jsonResponse( 401 )->send(); } return $route; }, 10, "LOGIN_REDIRECT" ); Hooks::add('router::get->api.v1.rest.routes', function( $routes ) { $routes[] = [ "name" => "usermenu", "title" => "Mein Profil", "icon" => "bi bi-people", "menu" => "navbar", ]; return $routes; }, 200 ); Hooks::add('public::api->init', [ Users\API\v1\Routes::class, "register" ] ); /** Datei: plugins/users/hooks/theme.php **/ before", function() { ?>


/** Datei: plugins/users/config.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * * @since 1.0.0 File is created */ /** Datei: plugins/users/config/schema/v1.0.0.php **/ array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT_GENERATED DEFAULT \'CURRENT_TIMESTAMP\'', 'date_edit' => 'DATETIME DEFAULT_GENERATED ON UPDATE CURRENT_TIMESTAMP DEFAULT \'CURRENT_TIMESTAMP\'', 'status' => 'TINYINT(1) DEFAULT \'0\'', 'username' => 'VARCHAR(255)', 'password' => 'VARCHAR(255)', 'email' => 'VARCHAR(255)', 'role' => 'TINYINT(1)', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( ), 'engine' => 'InnoDB', 'charset' => 'utf8mb3', ), 'users_meta' => array ( 'columns' => array ( 'id' => 'INT NOT NULL AUTO_INCREMENT', 'date_create' => 'DATETIME DEFAULT_GENERATED DEFAULT \'CURRENT_TIMESTAMP\'', 'date_edit' => 'DATETIME DEFAULT_GENERATED ON UPDATE CURRENT_TIMESTAMP DEFAULT \'CURRENT_TIMESTAMP\'', 'origin_id' => 'INT NOT NULL', 'meta_key' => 'VARCHAR(255) NOT NULL', 'meta_value' => 'TEXT', ), 'primary' => array ( 0 => 'id', ), 'indexes' => array ( 'origin_id' => array ( 0 => 'origin_id', 1 => 'meta_key', ), ), 'engine' => 'InnoDB', 'charset' => 'utf8mb3', ), ); /** Datei: plugins/users/migrations/2025_01_07_create_users_table.php **/