def can_view_profile(self, user):
        # Simple cases first, we don't want to waste CPU and DB hits.
        # Everyone.
        if self.privacy == 'open':
            return True
        # Registered users.
        elif self.privacy == 'registered' \
        and isinstance(user, get_user_model()):
            return True

        # Checks done by guardian for owner and admins.
        elif 'view_profile' in get_perms(user, self):
            return True

        # Fallback to closed profile.
        return False
Can the :class:`User` view this profile?
dataset/ETHPy150Open clione/django-kanban/src/core/userena/models.py/UserenaBaseProfile.can_view_profile