From 32c2441cabf928094877d97a2af4e99052784657 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 12 Mar 2025 17:34:12 -0400 Subject: [PATCH] mgr/smb: add a password filer enum for input passwords Add a 2nd password filter enum but this one is only for input passwords. Specifically, the 'hidden' filter makes no sense because we don't want junk passwords in the data store so we only take unfiltered or base64 obscured password values. Signed-off-by: John Mulligan --- src/pybind/mgr/smb/enums.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pybind/mgr/smb/enums.py b/src/pybind/mgr/smb/enums.py index 5606c3faf3c..c1c7ec1117d 100644 --- a/src/pybind/mgr/smb/enums.py +++ b/src/pybind/mgr/smb/enums.py @@ -115,3 +115,17 @@ class PasswordFilter(_StrEnum): NONE = 'none' BASE64 = 'base64' HIDDEN = 'hidden' + + +class InputPasswordFilter(_StrEnum): + """Filter type for input password values.""" + + NONE = 'none' + BASE64 = 'base64' + + def to_password_filter(self) -> PasswordFilter: + """Convert input password filter to password filter type.""" + # This is because python doesn't allow extending enums (with values) + # but we want a InputPasswordFilter to be a strict subset of the + # password filter enum. + return PasswordFilter(self.value) -- 2.39.5