#NEWLINE# def _user_has_perm( user , perm , obj ) : #NEWLINE# #INDENT# anon = user . is_anonymous ( ) #NEWLINE# active = user . is_active #NEWLINE# for backend in auth . get_backends ( ) : #NEWLINE# #INDENT# if ( ( ( not active ) and ( not anon ) and backend . supports_inactive_user ) or ( ( not anon ) or backend . supports_anonymous_user ) ) : #NEWLINE# #INDENT# if hasattr ( backend , 'has_perm' ) : #NEWLINE# #INDENT# if ( obj is not None ) : #NEWLINE# #INDENT# if ( backend . supports_object_permissions and backend . has_perm ( user , perm , obj ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if backend . has_perm ( user , perm ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return False