#NEWLINE# def can_view_profile( self , user ) : #NEWLINE# #INDENT# '\n        Can the :class:`User` view this profile?\n\n        Returns a boolean if a user has the rights to view the profile of this\n        user.\n\n        Users are divided into four groups:\n\n            ``Open``\n                Everyone can view your profile\n\n            ``Closed``\n                Nobody can view your profile.\n\n            ``Registered``\n                Users that are registered on the website and signed\n                in only.\n\n            ``Admin``\n                Special cases like superadmin and the owner of the profile.\n\n        Through the ``privacy`` field a owner of an profile can define what\n        they want to show to whom.\n\n        :param user:\n            A Django :class:`User` instance.\n\n        ' #NEWLINE# if ( self . privacy == 'open' ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( self . privacy == 'registered' ) and isinstance ( user , get_user_model ( ) ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'view_profile' in get_perms ( self , self ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return False