#NEWLINE# def has_permission( self , request , view ) : #NEWLINE# #INDENT# approving_user = request . user #NEWLINE# if ( approving_user . is_staff or ( request . method in SAFE_METHODS ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( request . method == 'POST' ) and ( view . action_map . get ( 'post' ) in [ 'approve_organization' , 'reject_organization' , 'remove_organization' ] ) ) : #NEWLINE# #INDENT# candidate_user = view . get_object ( ) #NEWLINE# if ( ( approving_user == candidate_user ) and ( view . action_map . get ( 'post' ) == 'remove_organization' ) and ( not candidate_user . organization_approved ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# return _can_manage_organization ( candidate_user , approving_user ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( view . suffix == 'List' ) or ( request . method == 'DELETE' ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( approving_user == view . get_object ( ) )