From e61f396cc79f013c0c0db0f521888c3bb878dd99 Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Fri, 6 Dec 2013 12:10:20 +0530 Subject: Fix typo and add comment Fix spelling of "privileges" in gswauth-* commands. Add comment to clarify use of req.credentials_valid. Change-Id: Ibb4d331f57df29e28670252b1360b3a72ea688cf Signed-off-by: Prashanth Pai Reviewed-on: http://review.gluster.org/6448 Reviewed-by: Luis Pabon Tested-by: Luis Pabon --- .../common/middleware/gswauth/bin/gswauth-add-account | 2 +- .../swift/common/middleware/gswauth/bin/gswauth-add-user | 2 +- .../common/middleware/gswauth/bin/gswauth-delete-account | 2 +- .../common/middleware/gswauth/bin/gswauth-delete-user | 2 +- gluster/swift/common/middleware/gswauth/bin/gswauth-list | 2 +- .../middleware/gswauth/bin/gswauth-set-account-service | 2 +- .../swift/common/middleware/gswauth/swauth/middleware.py | 14 ++++++++++++++ 7 files changed, 20 insertions(+), 6 deletions(-) (limited to 'gluster/swift/common/middleware') diff --git a/gluster/swift/common/middleware/gswauth/bin/gswauth-add-account b/gluster/swift/common/middleware/gswauth/bin/gswauth-add-account index 137ffb8..0f72f06 100755 --- a/gluster/swift/common/middleware/gswauth/bin/gswauth-add-account +++ b/gluster/swift/common/middleware/gswauth/bin/gswauth-add-account @@ -70,7 +70,7 @@ if __name__ == '__main__': exit('Account creation failed: %s %s: Invalid user/key provided' % (resp.status, resp.reason)) elif resp.status == 403: - exit('Account creation failed: %s %s: Insufficient priveleges' % + exit('Account creation failed: %s %s: Insufficient privileges' % (resp.status, resp.reason)) else: exit('Account creation failed: %s %s' % diff --git a/gluster/swift/common/middleware/gswauth/bin/gswauth-add-user b/gluster/swift/common/middleware/gswauth/bin/gswauth-add-user index 3ede12a..b9588ef 100755 --- a/gluster/swift/common/middleware/gswauth/bin/gswauth-add-user +++ b/gluster/swift/common/middleware/gswauth/bin/gswauth-add-user @@ -100,7 +100,7 @@ if __name__ == '__main__': exit('User creation failed: %s %s: Invalid user/key provided' % (resp.status, resp.reason)) elif resp.status == 403: - exit('User creation failed: %s %s: Insufficient priveleges' % + exit('User creation failed: %s %s: Insufficient privileges' % (resp.status, resp.reason)) else: exit('User creation failed: %s %s' % diff --git a/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account b/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account index 7bd513c..be8ace8 100755 --- a/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account +++ b/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-account @@ -61,7 +61,7 @@ if __name__ == '__main__': exit('Delete account failed: %s %s: Invalid user/key provided' % (resp.status, resp.reason)) elif resp.status == 403: - exit('Delete account failed: %s %s: Insufficient priveleges' % + exit('Delete account failed: %s %s: Insufficient privileges' % (resp.status, resp.reason)) elif resp.status == 404: exit('Delete account failed: %s %s: Account %s does not exist' % diff --git a/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-user b/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-user index 5958d5e..2b4f4fe 100755 --- a/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-user +++ b/gluster/swift/common/middleware/gswauth/bin/gswauth-delete-user @@ -61,7 +61,7 @@ if __name__ == '__main__': exit('Delete user failed: %s %s: Invalid user/key provided' % (resp.status, resp.reason)) elif resp.status == 403: - exit('Delete user failed: %s %s: Insufficient priveleges' % + exit('Delete user failed: %s %s: Insufficient privileges' % (resp.status, resp.reason)) elif resp.status == 404: exit('Delete user failed: %s %s: User %s does not exist' % diff --git a/gluster/swift/common/middleware/gswauth/bin/gswauth-list b/gluster/swift/common/middleware/gswauth/bin/gswauth-list index ebf9b6f..23175e9 100755 --- a/gluster/swift/common/middleware/gswauth/bin/gswauth-list +++ b/gluster/swift/common/middleware/gswauth/bin/gswauth-list @@ -86,7 +86,7 @@ If the [user] is '.groups', the active groups for the account will be listed. exit('List failed: %s %s: Invalid user/key provided' % (resp.status, resp.reason)) elif resp.status == 403: - exit('List failed: %s %s: Insufficient priveleges' % + exit('List failed: %s %s: Insufficient privileges' % (resp.status, resp.reason)) else: exit('List failed: %s %s' % (resp.status, resp.reason)) diff --git a/gluster/swift/common/middleware/gswauth/bin/gswauth-set-account-service b/gluster/swift/common/middleware/gswauth/bin/gswauth-set-account-service index eef4f05..b78524d 100755 --- a/gluster/swift/common/middleware/gswauth/bin/gswauth-set-account-service +++ b/gluster/swift/common/middleware/gswauth/bin/gswauth-set-account-service @@ -74,7 +74,7 @@ Example: %prog -K gswauthkey test storage local http://127.0.0.1:8080/v1/AUTH_01 exit('Service set failed: %s %s: Invalid user/key provided' % (resp.status, resp.reason)) elif resp.status == 403: - exit('Service set failed: %s %s: Insufficient priveleges' % + exit('Service set failed: %s %s: Insufficient privileges' % (resp.status, resp.reason)) else: exit('Service set failed: %s %s' % (resp.status, resp.reason)) diff --git a/gluster/swift/common/middleware/gswauth/swauth/middleware.py b/gluster/swift/common/middleware/gswauth/swauth/middleware.py index 648203e..ac1b295 100644 --- a/gluster/swift/common/middleware/gswauth/swauth/middleware.py +++ b/gluster/swift/common/middleware/gswauth/swauth/middleware.py @@ -1420,6 +1420,13 @@ class Swauth(object): Returns True if the admin specified in the request represents a .reseller_admin. + The variable req.credentials_valid is set to True if the credentials + match. This is used to distinguish between HTTPUnauthorized and + HTTPForbidden cases in denied_response method. HTTPUnauthorized is + returned when the credentials(username and key) do not match. A + HTTPForbidden is returned when the credentials match, but the user does + not have necessary permission to perform the requested action. + :param req: The swob.Request to check. :param admin_detail: The previously retrieved dict from :func:`get_admin_detail` or None for this function @@ -1442,6 +1449,13 @@ class Swauth(object): Returns True if the admin specified in the request represents a .admin for the account specified. + The variable req.credentials_valid is set to True if the credentials + match. This is used to distinguish between HTTPUnauthorized and + HTTPForbidden cases in denied_response method. HTTPUnauthorized is + returned when the credentials(username and key) do not match. A + HTTPForbidden is returned when the credentials match, but the user does + not have necessary permission to perform the requested action. + :param req: The swob.Request to check. :param account: The account to check for .admin against. :param returns: True if .admin. -- cgit