Phasor  01.00.10.059
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Admin.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include "../Common/Streams.h"
5 
7 
8 namespace commands
9 {
10  class CArgParser;
11 }
12 
13 namespace Admin
14 {
15  enum result_t
16  {
17  E_OK = 0,
23  };
24 
25  // Attempts to add the the admin to the list
26  result_t add(const std::string& hash, const std::string& authname, int level);
27 
28  // Removes an existing admin, does nothing if they're not an admin.
29  void remove(const std::string& hash);
30 
31  // Checks if a player is an admin
32  bool isAdmin(const std::string& hash);
33 
34  // Gets an admin's access level.
35  bool getLevel(const std::string& hash, int* level);
36 
37  // Checks if hash challenging is enabled (defaults to true)
38  bool isChallengeEnabled();
39 
40  // Checks if a player can execute the specified command
41  // Returns E_OK if there are no admins (the system is inactive)
42  result_t canUseCommand(const std::string& hash, const std::string& command,
43  std::string* authName=NULL);
44 
45  // Initialize the admin system, outputting errors to 'out'.
46  // Errors aren't output if 'out' is NULL.
47  void initialize(COutStream* out);
48 
49  // Reloads the admin/access files
50  void reload();
51 
52  // -------------------------------------------------------------------
53  //
63 
71 
77 
83 
89 
95 
102 }