From bc67b224138ca273995b172ba4e03c2bb674e2b2 Mon Sep 17 00:00:00 2001 From: Daniel Russell Date: Fri, 8 Sep 2017 10:21:09 +1000 Subject: [PATCH] Allows the use of dollar sign in usernames Change-Id: I12c41a46140b07f76565d8934e0326480477c636 Closes-Bug: 1715768 --- manila/api/common.py | 4 ++-- manila/tests/api/test_common.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/manila/api/common.py b/manila/api/common.py index e9b042cee1..412c71d7f4 100644 --- a/manila/api/common.py +++ b/manila/api/common.py @@ -337,12 +337,12 @@ def validate_common_name(access): def validate_username(access): - valid_username_re = '[\w\.\-_\`;\'\{\}\[\]\\\\]{4,255}$' + valid_username_re = '[\w\$\.\-_\`;\'\{\}\[\]\\\\]{4,255}$' username = access if not re.match(valid_username_re, username): exc_str = ('Invalid user or group name. Must be 4-255 characters ' 'and consist of alphanumeric characters and ' - 'special characters ]{.-_\'`;}[\\') + 'special characters $]{.-_\'`;}[\\') raise webob.exc.HTTPBadRequest(explanation=exc_str) diff --git a/manila/tests/api/test_common.py b/manila/tests/api/test_common.py index bf9ed599f1..fb3205bb0a 100644 --- a/manila/tests/api/test_common.py +++ b/manila/tests/api/test_common.py @@ -257,6 +257,7 @@ class MiscFunctionsTest(test.TestCase): @ddt.data(['ip', '1.1.1.1', False, False], ['user', 'alice', False, False], ['cert', 'alice', False, False], ['cephx', 'alice', True, False], + ['user', 'alice$', False, False], ['ip', '172.24.41.0/24', False, False], ['ip', '1001::1001', False, True], ['ip', '1001::1000/120', False, True])