#NEWLINE# def check_redaction( self , event , auth_events ) : #NEWLINE# #INDENT# 'Check whether the event sender is allowed to redact the target event.\n\n        Returns:\n            True if the the sender is allowed to redact the target event if the\n            target event was created by them.\n            False if the sender is allowed to redact the target event with no\n            further checks.\n\n        Raises:\n            AuthError if the event sender is definitely not allowed to redact\n            the target event.\n        ' #NEWLINE# user_level = self . _get_user_power_level ( event . user_id , auth_events ) #NEWLINE# redact_level = self . _get_named_level ( auth_events , 'redact' , 50 ) #NEWLINE# if ( user_level >= redact_level ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# redacter_domain = EventID . from_string ( event . event_id ) . domain #NEWLINE# redactee_domain = EventID . from_string ( event . redacts ) . domain #NEWLINE# if ( redacter_domain == redactee_domain ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# raise AuthError ( 403 , "You don't have permission to redact events" )