aboutsummaryrefslogtreecommitdiff
path: root/diplomacy/server/user.py
diff options
context:
space:
mode:
authorSatya Ortiz-Gagne <satya.ortiz-gagne@mila.quebec>2019-06-10 10:12:45 -0400
committerPhilip Paquette <pcpaquette@gmail.com>2019-06-14 15:08:29 -0400
commit4979f43baba8c7377471bbf65e7b5c003bf65406 (patch)
treec7c188edfbbb2a061a50ce0ec976b86d079e0dff /diplomacy/server/user.py
parenta47a787bbc15fc01a20fef7df05437fd3ce7eae8 (diff)
DAIDE - Implemented notifications and notification_managers
- MAP = MapNameNotification - HLO = HelloNotification - SCO = SupplyCenterNotification - NOW = CurrentPositionNotification - MIS = MissingOrdersNotification - ORD = OrderResultNotification - TME = TimeToDeadlineNotification - CCD = PowerInCivilDisorderNotification - OUT = PowerIsEliminatedNotification - DRW = DrawNotification - FRM = MessageFromNotification - SLO = SoloNotification - SMR = SummaryNotification - OFF = TurnOffNotification
Diffstat (limited to 'diplomacy/server/user.py')
-rw-r--r--diplomacy/server/user.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/diplomacy/server/user.py b/diplomacy/server/user.py
index cfb6ad4..11cca15 100644
--- a/diplomacy/server/user.py
+++ b/diplomacy/server/user.py
@@ -15,7 +15,7 @@
# with this program. If not, see <https://www.gnu.org/licenses/>.
# ==============================================================================
""" User object, defined with a username and a hashed password. """
-from diplomacy.utils import strings
+from diplomacy.utils import strings, parsing
from diplomacy.utils.common import is_valid_password
from diplomacy.utils.jsonable import Jsonable
@@ -35,3 +35,18 @@ class User(Jsonable):
def is_valid_password(self, password):
""" Return True if given password matches user hashed password. """
return is_valid_password(password, self.password_hash)
+
+class DaideUser(User):
+ """ DAIDE user class """
+ __slots__ = ['username', 'password_hash', 'client_name', 'client_version', 'passcode']
+ model = parsing.extend_model(User.model, {
+ strings.CLIENT_NAME: str,
+ strings.CLIENT_VERSION: str,
+ strings.PASSCODE: parsing.OptionalValueType(int)
+ })
+
+ def __init__(self, **kwargs):
+ self.client_name = ''
+ self.client_version = ''
+ self.passcode = 0
+ super(DaideUser, self).__init__(**kwargs)