#NEWLINE# def is_user_changing_own_key( self , req , user ) : #NEWLINE# #INDENT# 'Check if the user is changing his own key.\n\n        :param req: The swob.Request to check. This contains x-auth-admin-user\n                    and x-auth-admin-key headers which are credentials of the\n                    user sending the request.\n        :param user: User whose password is to be changed.\n        :returns True if user is changing his own key, False if not.\n        ' #NEWLINE# admin_detail = self . get_admin_detail ( req ) #NEWLINE# if ( not req ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( '.admin' not in ( g [ 'name' ] for g in admin_detail [ 'groups' ] ) ) : #NEWLINE# #INDENT# if ( ( req . headers . get ( 'x-auth-user-admin' ) == 'true' ) or ( req . headers . get ( 'x-auth-user-reseller-admin' ) == 'true' ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# if ( ( '.reseller_admin' not in ( g [ 'name' ] for g in admin_detail [ 'groups' ] ) ) and ( req . headers . get ( 'x-auth-user-reseller-admin' ) == 'true' ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# return ( ( req . headers . get ( 'x-auth-admin-user' ) == user ) and self . credentials_match ( admin_detail , req . headers . get ( 'x-auth-admin-key' ) ) )