Skip to content

Commit 32c2441

Browse files
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 <[email protected]>
1 parent 54cd675 commit 32c2441

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/pybind/mgr/smb/enums.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,17 @@ class PasswordFilter(_StrEnum):
115115
NONE = 'none'
116116
BASE64 = 'base64'
117117
HIDDEN = 'hidden'
118+
119+
120+
class InputPasswordFilter(_StrEnum):
121+
"""Filter type for input password values."""
122+
123+
NONE = 'none'
124+
BASE64 = 'base64'
125+
126+
def to_password_filter(self) -> PasswordFilter:
127+
"""Convert input password filter to password filter type."""
128+
# This is because python doesn't allow extending enums (with values)
129+
# but we want a InputPasswordFilter to be a strict subset of the
130+
# password filter enum.
131+
return PasswordFilter(self.value)

0 commit comments

Comments
 (0)