- user actions fixed

- action_dump added
This commit is contained in:
Wiesner András 2024-09-16 21:42:41 +02:00
parent e6aadf0a5c
commit 35549ecf20
2 changed files with 23 additions and 2 deletions

View File

@ -30,6 +30,10 @@ class ReqHandlerAssignment
$this->hint = $hint;
$this->rh = &$rh; // assign be reference
}
function dump() : string {
return "<i><font color='#2f4f4f'>" . $this->action . "</font></i>(<code>" . join(", ", $this->params) . "</code>) <font color='#008b8b'>" . $this->hint . "</font> [" . $this->level . "]";
}
}
// Request Handler class
@ -136,4 +140,15 @@ class ReqHandler
function set_privilege_level(string $level) {
$this->level = $level;
}
// Dump commands
function dump_actions() : string {
$dump = "";
foreach ($this->mapping as $level => $actions) {
foreach ($actions as $action) {
$dump .= $action->dump() . "<br>";
}
}
return $dump;
}
}

View File

@ -592,8 +592,14 @@ $rh->add("search_groups", ["needle"], PRIVILEGE_QUIZMASTER, "search_player_group
$rh->add(["create_user", "update_user"], ["nickname", "password", "groups", "realname", "privilege"], PRIVILEGE_QUIZMASTER, "create_update_user", RESP_PLAIN, "Create or update user.");
$rh->add("delete_users", ["users"], PRIVILEGE_QUIZMASTER, "delete_users", RESP_PLAIN, "Delete users.");
$rh->add("get_all_game_users", [], PRIVILEGE_QUIZMASTER, "get_all_users", RESP_JSON, "Get all users.");
$rh->add("import_users_from_csv", [], PRIVILEGE_QUIZMASTER, "import_", RESP_JSON, "Get all users.");
$rh->add("get_all_users", [], PRIVILEGE_QUIZMASTER, "get_all_game_users", RESP_JSON, "Get all users.");
$rh->add("import_users_from_csv", [], PRIVILEGE_QUIZMASTER, "import_users_from_csv", RESP_JSON, "Get all users.");
function dump_actions(ReqHandler &$rh, array $params): string {
return $rh->dump_actions();
}
$rh->add("dump_actions", [], PRIVILEGE_QUIZMASTER, "dump_actions", RESP_PLAIN, "Dump registered all actions.");
// ----------