diff options
author | Derek Higgins <derekh@redhat.com> | 2012-11-23 09:17:24 +0000 |
---|---|---|
committer | Derek Higgins <derekh@redhat.com> | 2012-11-27 09:14:14 +0000 |
commit | 1f6a0af9c1ddf25cceea7dc837bfb3c276b71a34 (patch) | |
tree | c58b0adf6b4c104d818cee996ec82ae8e4293ac5 /keystoneclient/client.py | |
parent | 66339b004ac0c0882afaf88b551db1e6896c1a09 (diff) | |
download | python-keystoneclient-1f6a0af9c1ddf25cceea7dc837bfb3c276b71a34.tar.gz |
Add command to allow users to change their own password
Fixes Bug 1082539
The Equivalent of doing
curl -X PATCH http://localhost:5000/v2.0/OS-KSCRUD/users/<userid> \
-H "Content-type: application/json" \
-H "X_Auth_Token: <authtokenid>" \
-d '{"user": {"password": "ABCD", "original_password": "DCBA"}}'
Change-Id: Ia1a907c5fd138c4252196145b361f43671047a1a
Diffstat (limited to 'keystoneclient/client.py')
-rw-r--r-- | keystoneclient/client.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/keystoneclient/client.py b/keystoneclient/client.py index c15cdc1..de86258 100644 --- a/keystoneclient/client.py +++ b/keystoneclient/client.py @@ -187,14 +187,21 @@ class HTTPClient(httplib2.Http): concatenating self.management_url and url and passing in method and any associated kwargs. """ - if self.management_url is None: + is_management = kwargs.pop('management', True) + + if is_management and self.management_url is None: raise exceptions.AuthorizationFailure( 'Current authorization does not have a known management url') + + url_to_use = self.auth_url + if is_management: + url_to_use = self.management_url + kwargs.setdefault('headers', {}) if self.auth_token: kwargs['headers']['X-Auth-Token'] = self.auth_token - resp, body = self.request(self.management_url + url, method, + resp, body = self.request(url_to_use + url, method, **kwargs) return resp, body |