From 5b9d0b23aae9265878655537a804f90907a40554 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 27 Oct 2024 22:10:10 +0100 Subject: [PATCH] added mpsks clients added mpsk client to user profile #498 --- sipa/blueprints/usersuite.py | 1 + sipa/model/pycroft/schema.py | 7 +++++++ sipa/model/pycroft/user.py | 6 +++--- sipa/model/user.py | 4 ++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/sipa/blueprints/usersuite.py b/sipa/blueprints/usersuite.py index 5d0c8184..0827d3de 100644 --- a/sipa/blueprints/usersuite.py +++ b/sipa/blueprints/usersuite.py @@ -101,6 +101,7 @@ def index(): ("mail_confirmed", [gettext("Status deiner E-Mail-Adresse")]), ("mail_forwarded", [gettext("E-Mail-Weiterleitung")]), ("wifi_password", [gettext("WLAN Passwort")]), + ("mpsks_clients", [gettext("WLAN mpsks clients"),gettext("Für Geräte die kein WPA-Enterprise Unterstützen") ]), # ('hostname', gettext("Hostname")), # ('hostalias', gettext("Hostalias")), ("userdb_status", [gettext("MySQL Datenbank")]), diff --git a/sipa/model/pycroft/schema.py b/sipa/model/pycroft/schema.py index 68261188..0afa1d20 100644 --- a/sipa/model/pycroft/schema.py +++ b/sipa/model/pycroft/schema.py @@ -29,6 +29,7 @@ class UserData(BaseModel): membership_end_date: date | None membership_begin_date: date | None wifi_password: str | None + mpsk_clients: list[MPSKClientEntry] class UserStatus(BaseModel): @@ -55,3 +56,9 @@ class FinanceHistoryEntry(BaseModel): valid_on: str amount: Decimal description: str + + +class MPSKClientEntry(BaseModel): + mac: str + name: str + id: int diff --git a/sipa/model/pycroft/user.py b/sipa/model/pycroft/user.py index 7ba64942..0c00850f 100644 --- a/sipa/model/pycroft/user.py +++ b/sipa/model/pycroft/user.py @@ -320,9 +320,9 @@ def membership_end_date(self) -> ActiveProperty[date | None, date | None]: capabilities=Capabilities.edit_if(self.is_member), ) - @poperty - def mpsks_clients(self) -> List[MPSK_Client]: - return + @property + def mpsks_clients(self) -> ActiveProperty[str | None, str | None]: + return ActiveProperty (name="mpsks_clients") @property def is_member(self) -> bool: diff --git a/sipa/model/user.py b/sipa/model/user.py index c224e2c6..8f26eda8 100644 --- a/sipa/model/user.py +++ b/sipa/model/user.py @@ -311,6 +311,10 @@ def is_member(self) -> bool: def wifi_password(self) -> PropertyBase[str, str | None]: return UnsupportedProperty("wifi_password") + @property + def mpsks_clients(self) -> PropertyBase[str, str | None]: + return UnsupportedProperty("mpsks_clients") + @classmethod def request_password_reset(cls, user_ident, email): raise NotImplementedError