diff --git a/class/ReqHandler.php b/class/ReqHandler.php index 65136ed..a588555 100644 --- a/class/ReqHandler.php +++ b/class/ReqHandler.php @@ -30,6 +30,10 @@ class ReqHandlerAssignment $this->hint = $hint; $this->rh = &$rh; // assign be reference } + + function dump() : string { + return "" . $this->action . "(" . join(", ", $this->params) . ") " . $this->hint . " [" . $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() . "
"; + } + } + return $dump; + } } \ No newline at end of file diff --git a/interface.php b/interface.php index b75fb4d..70b3ba9 100644 --- a/interface.php +++ b/interface.php @@ -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."); // ----------