- user actions fixed
- action_dump added
This commit is contained in:
		
							parent
							
								
									e6aadf0a5c
								
							
						
					
					
						commit
						35549ecf20
					
				@ -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;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -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.");
 | 
			
		||||
 | 
			
		||||
// ----------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user