]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/smb: add a password filer enum for input passwords
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 12 Mar 2025 21:34:12 +0000 (17:34 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 1 Apr 2025 12:02:39 +0000 (08:02 -0400)
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 <jmulligan@redhat.com>
src/pybind/mgr/smb/enums.py

index 5606c3faf3c8620b7d453e6dff33e7da6ca32e6a..c1c7ec1117df670f69e3673d7a01396f08851cf9 100644 (file)
@@ -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)