#NEWLINE# def SendRetrievalEmail( self , entity , user ) : #NEWLINE# #INDENT# 'Sends a retrieval notification email.\n\n    Args:\n      entity: models instance of retrieved object.  (E.G. FileVaultVolume,\n          DuplicityKeyPair, BitLockerVolume, etc.)\n      user: models.User object of the user that retrieved the secret.\n    ' #NEWLINE# data = { #NEWLINE# #INDENT# 'entity' : entity , #NEWLINE# 'helpdesk_email' : settings . HELPDESK_EMAIL , #NEWLINE# 'helpdesk_name' : settings . HELPDESK_NAME , #NEWLINE# 'retrieved_by' : user . user . email ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# body = self . RenderTemplate ( 'retrieval_email.txt' , data , response_out = False ) #NEWLINE# user_email = user . user . email ( ) #NEWLINE# try : #NEWLINE# #INDENT# self . VerifyPermissions ( permissions . SILENT_RETRIEVE , user = user ) #NEWLINE# to = ( [ user_email ] + settings . SILENT_AUDIT_ADDRESSES ) #NEWLINE# #UNINDENT# except models . AccessDeniedError : #NEWLINE# #INDENT# to = ( [ user_email ] + settings . RETRIEVE_AUDIT_ADDRESSES ) #NEWLINE# if entity . owner : #NEWLINE# #INDENT# if ( '@' in entity . owner ) : #NEWLINE# #INDENT# owner_email = entity . owner #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# owner_email = ( '%s@%s' % ( entity . owner , settings . DEFAULT_EMAIL_DOMAIN ) ) #NEWLINE# #UNINDENT# to . append ( owner_email ) #NEWLINE# #UNINDENT# #UNINDENT# subject_var = ( '%s_RETRIEVAL_EMAIL_SUBJECT' % entity . ESCROW_TYPE_NAME . upper ( ) ) #NEWLINE# subject = getattr ( settings , subject_var , 'Escrow secret retrieval notification.' ) #NEWLINE# util . SendEmail ( body , subject , body )