From c615ebbb6bd5e081fcce4c137b51303d7634d27d Mon Sep 17 00:00:00 2001
From: Daniel Russell <danielr@hostworks.com.au>
Date: Fri, 8 Sep 2017 10:16:54 +1000
Subject: [PATCH] Allows the use of dollar sign in usernames to allow for
 windows computer authentication in an active directory environment

Change-Id: I4b119e9e97262282d17a85911eb4b3b8f45ab521
Closes-Bug: 1715769
---
 manilaclient/tests/unit/v2/test_shares.py                | 2 +-
 manilaclient/v2/shares.py                                | 4 ++--
 releasenotes/notes/bug_1715769_fix-3ec701b0fb9d7910.yaml | 4 ++++
 3 files changed, 7 insertions(+), 3 deletions(-)
 create mode 100644 releasenotes/notes/bug_1715769_fix-3ec701b0fb9d7910.yaml

diff --git a/manilaclient/tests/unit/v2/test_shares.py b/manilaclient/tests/unit/v2/test_shares.py
index df7c8e03d..8ab8c92b1 100644
--- a/manilaclient/tests/unit/v2/test_shares.py
+++ b/manilaclient/tests/unit/v2/test_shares.py
@@ -371,7 +371,7 @@ class SharesTest(utils.TestCase):
          'action_name': 'os-allow_access', 'microversion': '2.0'},
         {'access_to': '1' * 255, 'access_type': 'user',
          'action_name': 'os-allow_access', 'microversion': '2.0'},
-        {'access_to': 'fake\\]{.-_\'`;}[', 'access_type': 'user',
+        {'access_to': 'fake$\\]{.-_\'`;}[', 'access_type': 'user',
          'action_name': 'os-allow_access', 'microversion': '2.0'},
         {'access_to': 'MYDOMAIN\\Administrator', 'access_type': 'user',
          'action_name': 'os-allow_access', 'microversion': '2.0'},
diff --git a/manilaclient/v2/shares.py b/manilaclient/v2/shares.py
index 4d8479c3b..0cd38692b 100644
--- a/manilaclient/v2/shares.py
+++ b/manilaclient/v2/shares.py
@@ -449,12 +449,12 @@ class ShareManager(base.ManagerWithFind):
 
     @staticmethod
     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 exceptions.CommandError(exc_str)
 
     @staticmethod
diff --git a/releasenotes/notes/bug_1715769_fix-3ec701b0fb9d7910.yaml b/releasenotes/notes/bug_1715769_fix-3ec701b0fb9d7910.yaml
new file mode 100644
index 000000000..d7ed43797
--- /dev/null
+++ b/releasenotes/notes/bug_1715769_fix-3ec701b0fb9d7910.yaml
@@ -0,0 +1,4 @@
+---
+fixes:
+  - Usernames can contain the $ symbol to allow for windows computer
+    authentication in an Active Directory environment