srv-users.h

Go to the documentation of this file.
00001 /*
00002  * srv-users.h
00003  *
00004  * Copyright (C) 2008,2009  Thomas A. Vaughan
00005  * All rights reserved.
00006  *
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *     * Redistributions of source code must retain the above copyright
00011  *       notice, this list of conditions and the following disclaimer.
00012  *     * Redistributions in binary form must reproduce the above copyright
00013  *       notice, this list of conditions and the following disclaimer in the
00014  *       documentation and/or other materials provided with the distribution.
00015  *     * Neither the name of the <organization> nor the
00016  *       names of its contributors may be used to endorse or promote products
00017  *       derived from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THOMAS A. VAUGHAN ''AS IS'' AND ANY
00020  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022  * DISCLAIMED. IN NO EVENT SHALL THOMAS A. VAUGHAN BE LIABLE FOR ANY
00023  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00026  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029  *
00030  * Server-side user management. 
00031  */
00032 
00033 #ifndef AESOP_SRV_USERS_H__
00034 #define AESOP_SRV_USERS_H__
00035 
00036 // includes --------------------------------------------------------------------
00037 #include "aesop-proto/protocol.h"
00038 
00039 
00040 // forward declarations
00041 class Datahash;
00042 
00043 
00044 namespace aesop {
00045 
00046 
00048 
00051 
00052 
00053 
00054 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125 
00126 
00127 
00128 
00129 
00130 class UserManager {
00131 public:
00132         // virtual destructor --------------------------------------------------
00133         virtual ~UserManager(void) throw();
00134 
00135         // aesop::UserManager class interface methods -------------------------
00136         virtual bool canCreateNewUsersTS(void) const throw() = 0;
00137         virtual bool passwordRequiredTS(void) const throw() = 0;
00138         virtual void getUsernamesTS(OUT SetString& names) = 0;
00139         virtual bool logInAsUserTS(IN const char * username,
00140                                 IN const char * password,
00141                                 OUT std::string& playerGuid,
00142                                 OUT std::string& diagnostic) = 0;
00143         virtual bool createUserTS(IN const char * username,
00144                                 OUT std::string& diagnostic) = 0;
00145         virtual bool isAdminTS(IN const char * username) = 0;
00146 
00147         // static factory methods ----------------------------------------------
00148         static smart_ptr<UserManager> create(IN const Datahash * params);
00149 };
00150 
00151 
00153 bool isValidUsername(IN const char * username);
00154 
00155 
00157 std::string getUsernameRestrictions(void);
00158 
00159 
00160 };      // aesop namespace
00161 
00162 #endif  // AESOP_SRV_USERS_H__
00163